tedious / Stash

The place to keep your cache.
http://www.stashphp.com
BSD 3-Clause "New" or "Revised" License
961 stars 133 forks source link

Use Flysystem in Filesystem driver #312

Open Anahkiasen opened 8 years ago

Anahkiasen commented 8 years ago

Currently the filesystem driver is limited to local filesystem, it would be nice if it used Flysystem underneath which would bring support for all the adapters the latter supports (Dropbox, SFTP, etc), has that been considered?

thinkspill commented 8 years ago

Wouldn't storing a cache on a remote filesystem add too much latency to cache operations?

Anahkiasen commented 8 years ago

Not any more latency than using cache on a remote Redis instance or anything similar. Having a Flysystem driver would open the door for any of the drivers it supports, S3, Dropbox, Azure, etc.

gggeek commented 6 years ago

I would not add any further layers to the Filesystem driver, but rather add a separate Flysystem driver. The reason is simple:

  1. race conditions are hard enough to debug with plain FS semantics (have you ever tried swapping local disk for NFS for a cache drive?). Flysystem adds another layer on top of storage systems that have wildly inconsistent semantics
  2. even assuming that no race conditions or corner-case bugs are introduced, perfs would still suffer compared to the current driver
Anahkiasen commented 6 years ago

I'd be fine with it being a separate driver. That being said you cannot make assumptions as to how people use cache, in the use case I needed this for there was only ever one user to interact with the cache at a time (as this was for a CLI app) and performance was not a concern. People use cache for a lot more things than just web applications. If I want to use Stash in a pet project to cache things on my DO instance or something, I should be able to. Cache is way too broad of a concept to make design decisions based on how you think it would be used.