class SgtnClient::CacheUtil

Public Class Methods

clear_cache() click to toggle source
# File lib/sgtn-client/util/cache-util.rb, line 17
def self.clear_cache()
  SgtnClient::Core::Cache.clear()
end
get_cache(cache_key) click to toggle source
# File lib/sgtn-client/util/cache-util.rb, line 12
def self.get_cache(cache_key)
  items = SgtnClient::Core::Cache.get(cache_key)
  return items
end
get_cachekey(component, locale) click to toggle source
# File lib/sgtn-client/util/cache-util.rb, line 31
def self.get_cachekey(component, locale)
  env = SgtnClient::Config.default_environment
  product_name = SgtnClient::Config.configurations[env]["product_name"]
  version = SgtnClient::Config.configurations[env]["version"].to_s
  return product_name + "_" + version + "_" + component + "_" + locale
end
write_cache(cache_key, items) click to toggle source
# File lib/sgtn-client/util/cache-util.rb, line 21
def self.write_cache(cache_key, items)
  env = SgtnClient::Config.default_environment
  cache_expiry_period = SgtnClient::Config.configurations[env]["cache_expiry_period"]
  # expired after 24 hours
  if cache_expiry_period == nil
      cache_expiry_period = 24*60
  end
  SgtnClient::Core::Cache.put(cache_key, items, cache_expiry_period)
end