Skip to content

thevalenciandev/in-memory-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

in-memory-cache

Build Status

This project uses Gradle 5.4.1. You can build it executing "gradlew build". You can execute tests by executing "gradlew test"

Dependencies are defined in build.gradle. Needs Java 8+.

The main class is BoundedInMemoryCache and it’s got a test that you can run as well, BoundedInMemoryCacheTest.

The cache is a DataSource itself, and you must pass a (potentially slow) DataSource delegate to this cache in the constructor, as well as the cache size.

Assumptions:

  • Keys are sanitized (never null)
  • Keys implement equals and hashCode
  • It’s a cache for performance sensitive applications
  • There can be multiple cache misses in very quick succession
  • Underlying (slow) data source calculations will eventually finish. Otherwise future.get() could block forever, and we’d need a smarter wait of waiting (with timeout), and cache eviction of those cancelled tasks

Releases

No releases published

Packages

No packages published