Stash icon indicating copy to clipboard operation
Stash copied to clipboard

Use Flysystem in Filesystem driver

Open Anahkiasen opened this issue 7 years ago • 4 comments

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?

Anahkiasen avatar Jul 16 '16 14:07 Anahkiasen

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

thinkspill avatar Aug 05 '16 01:08 thinkspill

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.

Anahkiasen avatar Aug 05 '16 09:08 Anahkiasen

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

gggeek avatar Nov 13 '17 18:11 gggeek

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.

Anahkiasen avatar Nov 14 '17 09:11 Anahkiasen