Sha256: e6c79f01a0146f6bdc3fcb2421bc5a8750f9ad966acf0a4b0de50c196631bef8
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# RefCache Setup and usage: ```ruby cache_config = { # redis: 'redis://localhost:6379/1', # optional, if omitted use in memory cache (Zache) domain: 'core.collectionspace.org', error_if_not_found: false, # raise error if key cannot be retrieved (default false) lifetime: 5 * 60, # cache expiry in seconds (default is 5 minutes) } cache = CollectionSpace::RefCache.new(config: cache_config) cache.get('placeauthorities', 'place', 'Death Valley') # $refname or error / nil if not found cache.exists?('placeauthorities', 'place', 'Death Valley') # check for key # example for vocabs cache.get('vocabularies', 'languages', 'English') # $refname or error / nil if not found cache.exists?('vocabularies', 'languages', 'English') # check for key ``` The cache can be pre-populated: ```ruby items = [ ['placeauthorities', 'place', 'Mars Colony', '$refname'] ].each do |item| cache.put(*item) end cache.exists?('placeauthorities', 'place', 'Mars Colony') # true cache.get('placeauthorities', 'place', 'Mars Colony') # '$refname' ```
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
collectionspace-refcache-1.0.0 | doc/REFCACHE.md |