Skip to content

Commit

Permalink
Re-indented the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredjean committed Jun 30, 2010
1 parent ad7b716 commit d116d6e
Show file tree
Hide file tree
Showing 2 changed files with 271 additions and 271 deletions.
18 changes: 9 additions & 9 deletions lib/memcache.rb
Expand Up @@ -85,11 +85,11 @@ def initialize(*args)
raise ArgumentError, "wrong number of arguments (#{args.length} for 2)"
end

# Normalizing the server(s) so they all have a port number.
@servers = @servers.map do |server|
server =~ /(.+):(\d+)/ ? server : "#{server}:#{DEFAULT_PORT}"
end
# Normalizing the server(s) so they all have a port number.

@servers = @servers.map do |server|
server =~ /(.+):(\d+)/ ? server : "#{server}:#{DEFAULT_PORT}"
end

Logger.getLogger('com.meetup.memcached.MemcachedClient').setLevel(opts[:log_level])
Logger.getLogger('com.meetup.memcached.SockIOPool').setLevel(opts[:log_level])
Expand Down Expand Up @@ -139,14 +139,14 @@ def initialize(*args)
@pool.hashingAlg = opts[:pool_hashing_algorithm]

# __method methods have been removed in jruby 1.5
@pool.java_send :initialize rescue @pool.initialize__method
@pool.java_send :initialize rescue @pool.initialize__method
end

end

def reset
@pool.shut_down
@pool.java_send :initialize rescue @pool.initialize__method
@pool.java_send :initialize rescue @pool.initialize__method
end

##
Expand Down Expand Up @@ -267,7 +267,7 @@ def replace(key, value, expiry = 0, raw = false)
# Increments the value associated with the key by a certain amount.
def incr(key, amount = 1)
raise MemCacheError, "Update of readonly cache" if @readonly
value = @client.incr(make_cache_key(key))
value = @client.incr(make_cache_key(key), amount)
return nil if value == "NOT_FOUND\r\n"
return value.to_i
end
Expand All @@ -276,7 +276,7 @@ def incr(key, amount = 1)
# Decrements the value associated with the key by a certain amount.
def decr(key, amount = 1)
raise MemCacheError, "Update of readonly cache" if @readonly
value = @client.decr(make_cache_key(key))
value = @client.decr(make_cache_key(key),amount)
return nil if value == "NOT_FOUND\r\n"
return value.to_i
end
Expand Down

0 comments on commit d116d6e

Please sign in to comment.