peterbourgon / diskv

A disk-backed key-value store.
http://godoc.org/github.com/peterbourgon/diskv
MIT License
1.4k stars 102 forks source link

CacheSizeMax ignored in WriteStream function #37

Closed beleon closed 6 years ago

beleon commented 6 years ago

The WriteStream function or to be precise the writeStreamWithLock function does not check for the CacheSizeMax option, which results in too large files being stored. Is this intentional because it's a stream? I'm using the github.com/gregjones/httpcache library which uses the WriteStream function. Anything that can be done here? :)

beleon commented 6 years ago

Any thoughts on this?

peterbourgon commented 6 years ago

WriteStream only busts the cache, never writes to it; caching is done on read. Do you mean ReadStream/readStreamWithLock?

beleon commented 6 years ago

Ah, there has been a misunderstanding on my part about what the CacheSizeMax option is supposed to do. I thought of the whole key value store as the cache (because this is the context I use it in) and therefore of the CacheSizeMax option as a limit for the maximum amount of space that the key value store is allowed to take up on the disk (that's what I would need). Sorry for that.