Sha256: 9f78399640a96d498dfb74a6740c8b303d36f359f31b8b16f0d1e9cde1c960f8

Contents?: true

Size: 740 Bytes

Versions: 14

Compression:

Stored size: 740 Bytes

Contents

class Card
  class Cache
    # pre-populate cache for testing purposes
    module Prepopulate
      def restore
        reset_soft
        prepopulate
      end

      private

      def prepopulate?
        Cardio.config.prepopulate_cache
      end

      def prepopulate
        return unless prepopulate?
        soft = Card.cache.soft
        @rule_cache ||= Card.rule_cache
        @user_ids_cache ||= Card.user_ids_cache
        @read_rule_cache ||= Card.read_rule_cache
        @rule_keys_cache ||= Card.rule_keys_cache
        soft.write "RULES", @rule_cache
        soft.write "READRULES", @read_rule_cache
        soft.write "USER_IDS", @user_ids_cache
        soft.write "RULE_KEYS", @rule_keys_cache
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
card-1.94.1 lib/card/cache/prepopulate.rb
card-1.94.0 lib/card/cache/prepopulate.rb
card-1.93.13 lib/card/cache/prepopulate.rb
card-1.93.12 lib/card/cache/prepopulate.rb
card-1.93.11 lib/card/cache/prepopulate.rb
card-1.93.10 lib/card/cache/prepopulate.rb
card-1.93.9 lib/card/cache/prepopulate.rb
card-1.93.8 lib/card/cache/prepopulate.rb
card-1.93.7 lib/card/cache/prepopulate.rb
card-1.93.6 lib/card/cache/prepopulate.rb
card-1.93.5 lib/card/cache/prepopulate.rb
card-1.93.4 lib/card/cache/prepopulate.rb
card-1.93.3 lib/card/cache/prepopulate.rb
card-1.93.2 lib/card/cache/prepopulate.rb