Skip to content
Snippets Groups Projects
repository_cache.rb 616 B
Newer Older
  • Learn to ignore specific revisions
  • # Interface to the Redis-backed cache store used by the Repository model
    class RepositoryCache
    
      attr_reader :namespace, :backend, :project_id
    
      def initialize(namespace, project_id, backend = Rails.cache)
    
        @namespace = namespace
        @backend = backend
    
      end
    
      def expire(key)
        backend.delete(cache_key(key))
      end
    
      def fetch(key, &block)
        backend.fetch(cache_key(key), &block)
      end
    
        backend.exist?(cache_key(key))
      end
    
      def read(key)
        backend.read(cache_key(key))