module HalApi::Controller::Cache

Private Instance Methods

current_time() click to toggle source
# File lib/hal_api/controller/cache.rb, line 15
def current_time
  Datetime.now
end
index_cache_path() click to toggle source
# File lib/hal_api/controller/cache.rb, line 6
def index_cache_path
  HalApi::PagedCollection.new(
    filtered(paged(sorted(scoped(resources_base)))),
    request,
    item_class: self.class.resource_class,
    item_decorator: self.class.resource_representer
  ).cache_key
end
show_cache_path() click to toggle source
# File lib/hal_api/controller/cache.rb, line 19
def show_cache_path
  timestamp = show_resource.updated_at || show_resource.created_at
  timestamp = if timestamp.nil?
                # skip the cache
                current_time
              else
                timestamp
              end
  timestamp.utc.to_i
end