• David H. Wilkins's avatar
    Make reactive caching clean up after itself · eec780c9
    David H. Wilkins authored
    - ReactiveCaching creates 2 keys per stored value - one that just
      stores a boolean true value (the `:alive` key) and one that stores
      the value. The `:alive` key that stores the boolean true is set to
      expire after `reactive_cache_lifetime` expires.
    
    - ReactiveCaching spawns ReactiveCachingWorker to update/create the
      value as needed.
    
    - if the `:alive` key is present when ReactiveCachingWorker executes
      the value key is updated / created.
    
    - if the `:alive` key is NOT present, this change will cause the value
      key to be deleted and release the memory consumed in Redis for the
      key and value.
    
    - There is no way for the value key to be re-used. If the `:alive` key
      has expired, a Rails.cache.delete is called for *both* keys
    eec780c9
reactive_caching.rb 5.66 KB