Skip to content

Commit

Permalink
Catch cache errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Jun 8, 2010
1 parent 1b8547f commit e1163b9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/models/data_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ def self.expire_container(container_class)
# content_target = the affected content like the blog.id or blogpost.id
# display_location = the specific display instance (like a paragraph / etc )
def self.put_content(content_type,content_target,display_location,data,expiration = 0)
CACHE.set("#{DomainModel.active_domain_db}::Content::#{content_type}::#{content_target}::#{display_location}",[ Time.now.to_f, data ],expiration )
begin
CACHE.set("#{DomainModel.active_domain_db}::Content::#{content_type}::#{content_target}::#{display_location}",[ Time.now.to_f, data ],expiration )
rescue ArgumentError => e
# chomp
end
end

# Pull a piece of content into the remote cache. The cache can be expired
Expand All @@ -162,10 +166,10 @@ def self.get_content(content_type,content_target,display_location)
display_location_string= content_target_string + "::" + display_location.to_s

ret_val = nil
begin
begin
ret_val = CACHE.get_multi(container_string,content_type_string,content_target_string,display_location_string)
rescue ArgumentError => e
return nil
ret_val = { }
end

val = ret_val[display_location_string]
Expand Down

0 comments on commit e1163b9

Please sign in to comment.