Kill trailing whitespace in ruby files
This commit is contained in:
@@ -4,7 +4,7 @@ class Cache
|
||||
Cache.put(key, val.to_i + 1)
|
||||
ActiveRecord::Base.logger.debug('MemCache Incr %s' % [key])
|
||||
end
|
||||
|
||||
|
||||
def self.decr(key, expiry = 0)
|
||||
val = Cache.get(key, expiry)
|
||||
if val.to_i > 0
|
||||
@@ -12,7 +12,7 @@ class Cache
|
||||
end
|
||||
ActiveRecord::Base.logger.debug('MemCache Decr %s' % [key])
|
||||
end
|
||||
|
||||
|
||||
def self.get_multi(keys, prefix, expiry = 0)
|
||||
key_to_sanitized_key_hash = keys.inject({}) do |hash, x|
|
||||
hash[x] = "#{prefix}:#{Cache.sanitize(x)}"
|
||||
@@ -30,11 +30,11 @@ class Cache
|
||||
Cache.put(sanitized_key, result_hash[key], expiry)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
ActiveRecord::Base.logger.debug('MemCache Multi-Get (%0.6f) %s' % [elapsed, keys.join(",")])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.get(key, expiry = 0)
|
||||
begin
|
||||
start_time = Time.now
|
||||
@@ -55,11 +55,11 @@ class Cache
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.put(key, value, expiry = 0)
|
||||
key.gsub!(/\s/, "_")
|
||||
key = key[0, 200]
|
||||
|
||||
|
||||
begin
|
||||
start_time = Time.now
|
||||
MEMCACHE.set key, value, expiry
|
||||
@@ -71,7 +71,7 @@ class Cache
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.delete(key, delay = nil)
|
||||
begin
|
||||
start_time = Time.now
|
||||
@@ -84,7 +84,7 @@ class Cache
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.sanitize(key)
|
||||
key.gsub(/\W/) {|x| "%#{x.ord}"}.slice(0, 240)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user