Skip to content

raphw/guava-cache-overflow-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

A Guava cache extension that allows caches to persist cache entries when they cannot longer be stored in memory.
An implementation that overflows to the file system is provided including a corresponding CacheBuilder with similar semantics than the Guava CacheBuilder.

For creating a cache that overflows to disk, just proceed as when using the Guava CacheBuilder:

Cache<String, String> stringCache =
  FileSystemCacheBuilder.newBuilder()
    .maximumSize(100L)
    .softValues()
    .build();

Note: This cache implementation has slightly different semantics than the Cache / LoadingCache interface contracts specify:
* Any limits set for this cache do only concern the cache's memory size. Cache entries exceeding this limit will overflow to disk.
* When calling the non-argument invalidateAll() method, the RemovalListener is only informed about the expiration of entries that are still stored in memory.
* When the cache is not longer in use, its invalidateAll() method should be called if the cache's overflow folder is not cleared by the operating system.

Licensed under the Apache Software License, Version 2.0

About

A Guava cache extension that allows caches to overflow to disk.

Resources

Stars

Watchers

Forks

Packages

No packages published