Skip to content

Commit

Permalink
Use the word object instead of result
Browse files Browse the repository at this point in the history
Signed-off-by: David Souza <david@souza.net>
  • Loading branch information
Morgan Brown authored and davidsouza committed Apr 5, 2012
1 parent e1fef16 commit 06fef3a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/cached_resource/caching.rb
Expand Up @@ -37,10 +37,10 @@ def find_via_cache(key, *arguments)
# re/send the request to fetch the resource. Cache the response # re/send the request to fetch the resource. Cache the response
# for the request. # for the request.
def find_via_reload(key, *arguments) def find_via_reload(key, *arguments)
result = find_without_cache(*arguments) object = find_without_cache(*arguments)
cache_collection_synchronize(result, *arguments) cache_collection_synchronize(object, *arguments)
cache_write(key, result) cache_write(key, object)
result object
end end


# if this is a pure, unadulterated "all" request # if this is a pure, unadulterated "all" request
Expand All @@ -59,17 +59,17 @@ def cache_collection_synchronize(object, *arguments)
# the key is processed to make sure it is valid # the key is processed to make sure it is valid
def cache_read(key) def cache_read(key)
key = cache_key(Array(key)) unless key.is_a? String key = cache_key(Array(key)) unless key.is_a? String
result = cached_resource.cache.read(key).try(:dup) object = cached_resource.cache.read(key).try(:dup)
result && cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} READ #{key}") object && cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} READ #{key}")
result object
end end


# write an entry to the cache for the given key and value. # write an entry to the cache for the given key and value.
# the key is processed to make sure it is valid # the key is processed to make sure it is valid
def cache_write(key, value) def cache_write(key, object)
key = cache_key(Array(key)) unless key.is_a? String key = cache_key(Array(key)) unless key.is_a? String
cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} WRITE #{key}") cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} WRITE #{key}")
cached_resource.cache.write(key, value, :expires_in => cached_resource.ttl) cached_resource.cache.write(key, object, :expires_in => cached_resource.ttl)
end end


# generate the request cache key # generate the request cache key
Expand Down

0 comments on commit 06fef3a

Please sign in to comment.