Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFileHaunter ¶ added in v0.49.0
func NewFileHaunter(name string, maxItems int, maxSize int64, period time.Duration) fscache.LRUHaunter
NewFileHaunter returns a simple haunter which runs every "period" and scrubs older files when the total file size is over maxSize or total item count is over maxItems. It also removes empty (invalid) files. If maxItems or maxSize are 0, they won't be checked
Based on fscache.NewLRUHaunter
func NewSpreadFS ¶
NewSpreadFS returns a FileSystem rooted at directory dir. This FS hashes the key and distributes all files in a layout like XX/XX/XXXXXXXXXX. Ex:
Key is abc123.300x300.jpg Hash would be: c574aeb3caafcf93ee337f0cf34e31a428ba3f13 File in cache would be: c5 / 74 / c574aeb3caafcf93ee337f0cf34e31a428ba3f13
The idea is to avoid having too many files in one dir, which could potentially cause performance issues and may hit limitations depending on the OS. See discussion here: https://github.com/djherbis/fscache/issues/8#issuecomment-614319323
dir is created with specified mode if it doesn't exist.
Types ¶
type CachedStream ¶
func (*CachedStream) Close ¶
func (s *CachedStream) Close() error