lib/card/cache/card_class.rb in card-1.101.4 vs lib/card/cache/card_class.rb in card-1.101.5
- old
+ new
@@ -2,10 +2,11 @@
class Cache
# cache-related class methods
module CardClass
def retrieve_from_cache cache_key, local_only=false
return unless cache
+
local_only ? cache.soft.read(cache_key) : cache.read(cache_key)
end
def retrieve_from_cache_by_id id, local_only=false
key = Card::Lexicon.name(id)&.key
@@ -26,15 +27,17 @@
end
end
def write_to_soft_cache card
return unless cache
+
cache.soft.write card.key, card
end
def expire name
key = name.to_name.key
return unless (card = Card.cache.read key)
+
card.expire
end
end
end
end