kylecorry31 / andromeda

A collection of Android libraries for simplifying development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create a generic cache

kylecorry31 opened this issue · comments

  • Key
  • Value

Metadata

  • Last accessed time
  • Access count
  • Create time

Strategies

  • Out of space removal strategy
    • Determines which key to prune when out of space
    • Inputs: key being inserted, all valid keys and metadata, target size
    • Output: keys to remove
  • Key selection strategy
    • Given the list of keys and a new key, it returns the key to insert/update
    • Inputs: key being inserted, all valid keys and metadata
    • Output: key to insert/update
  • Expiration strategy
    • Run before any operation on the cache
    • Inputs: key being inserted (if any), all valid keys and metadata
    • Output: keys to remove
  • Storage strategy
    • The backing cache store
    • Operations: get, remove, insert, update, get all keys and metadata

The goal is to replace the geospatial and LRU caches with a single cache.

Another option could be to compose this with wrappers of some sort (ex. SpaceLimitedWrapper, ExpirationWrapper, etc)