Sha256: 1e5474d0eb82001a83d6970cfa18de100ce03c67ef748f0d739b8b0dfded0c55
Contents?: true
Size: 1.02 KB
Versions: 22
Compression:
Stored size: 1.02 KB
Contents
require 'cutter' Cutter::Stamper.scope :cache_rules => "#cache_rules" do |stan| stan.msg :no_cache => 'No caching, going through engines' end module CanTango class Ability module Cache def cache_rules! stamper(:cache_rules) { return if !caching_on? invalidate_cache! rules_compiled = compile_rules! rules rules_cache.save cache_key, rules_compiled session_check! session[:cache_key] = cache_key } end # No #stamper here. # Wrapping decompilator in block causes decompiler (i.e. sourcify) is not working def cached_rules time_initial = time_now puts "#cached_rules:" rules_compiled = rules_cache.load(cache_key) time = time_now - time_initial puts " loading rules from store: (#{time}ms)" rules_raw = decompile_rules! rules_compiled time = time_now - time_initial puts " decompiling rules: (#{time}ms)" @rules ||= rules_raw end end end end
Version data entries
22 entries across 22 versions & 1 rubygems