class Botomizer::Cache

Attributes

prefix[R]

Public Class Methods

new(cache, prefix) click to toggle source
# File lib/botomizer/cache.rb, line 4
def initialize(cache, prefix)
  @cache = cache
  @prefix = prefix
end

Public Instance Methods

delete(key) click to toggle source
# File lib/botomizer/cache.rb, line 17
def delete(key)
  @cache.delete("#{@prefix}_#{key}") if @cache
end
exists?(key) click to toggle source
# File lib/botomizer/cache.rb, line 21
def exists?(key)
  @cache.exist?("#{@prefix}_#{key}")
end
fetch(key) click to toggle source
# File lib/botomizer/cache.rb, line 9
def fetch(key)
  @cache.fetch("#{@prefix}_#{key}") if @cache
end
write(key, value) click to toggle source
# File lib/botomizer/cache.rb, line 13
def write(key, value)
  @cache.write("#{@prefix}_#{key}", value, expires_in: 1.hour) if @cache
end