haskell-cache icon indicating copy to clipboard operation
haskell-cache copied to clipboard

Size limitations on Data.Cache instance

Open vishal-chauhan97 opened this issue 2 years ago • 1 comments

I have a certain use case where I am worried about the size of cache instance. Given it is an in memory data store I want to understand why you proceeded with no limit on size of Data.Cache instance.

Also what workaround would you recommend in case I want to restrict the size of cache instance.

vishal-chauhan97 avatar May 12 '23 11:05 vishal-chauhan97

The reason I have not implemented size restrictions is because I have not needed any.

if you want size restrictions. You’ll have to maintain the size of the cache to a certain limit when you do the insert operation.

Depending on the eviction policy you’ll need to keep track of additional metadata (e.g a FIFO queue if you’d like to evict the oldest item when inserting into a full cache).

Maybe you might be able to build it around the existing API, since all the STM operations are exposed!

hverr avatar May 15 '23 20:05 hverr