module PuppetForgeServer::Utils::CacheProvider

Public Instance Methods

cache_instance() click to toggle source

Method for fetching application wide cache for fetching HTTP requests

@return [LRUCache] a instance of cache for application

# File lib/puppet_forge_server/utils/cache_provider.rb, line 27
def cache_instance
  @@CACHE
end
configure_cache(ttl, size) click to toggle source

Configure a application wide cache using LSUCache implementation

@param [int] ttl a time to live for elements @param [int] size a maximum size for cache

# File lib/puppet_forge_server/utils/cache_provider.rb, line 35
def configure_cache(ttl, size)
  @@CACHE = LRUCache.new(:ttl => ttl, :max_size => size)
  PuppetForgeServer::Logger.get.info("Using RAM memory LRUCache with time to live of #{ttl}sec and max size of #{size} elements")
  nil
end