0.0
The project is in a healthy, maintained state
Simple in memory cache
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.2
= 1.60.2
 Project Readme

Evanescence

Push & PR Gem Version

In memory cache which can limit the cache size by a maximum number by expiring the least used cached items.

Usage

Initiate a cache object. Optionally pass the max number of records as an argument:

cache = Evanescence.initialize_cache(max_size: 1000)

Write to cache: cache.write("key", value)

Read from cache: cache.read("key")

Delete from cache: cache.delete("key")

Delete the entire cache: cache.clear

Check the cache size: cache.count

In rails with activerecords:

Add gem "evanescence" to your gemfile.

In your ApplicationRecord:

require "evanescence/cacheable"

class ApplicationRecord < ActiveRecord::Base
  extend Evanescence::Cacheable
  ...
end

In your model class:

class Article < ApplicationRecord
  caches by: :id, max_size: 1000
  ...
end

In your controller:

Article.get_by(params[:id])

Next steps

Expire the cache after given time.

Enhance the API.