Skip to content

Commit

Permalink
Revert "Remove monkeypatch for Memcached.set_servers now that we're o…
Browse files Browse the repository at this point in the history
…n the latest version"

This reverts commit 8ad6728.
  • Loading branch information
packagethief committed Aug 11, 2008
1 parent 2f2a614 commit 053f795
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion init.rb
@@ -1 +1 @@

#config.gem 'memcached', :version => '>=0.10'
12 changes: 12 additions & 0 deletions lib/active_support/cache/libmemcached_store.rb
@@ -1,5 +1,17 @@
require 'memcached'

class Memcached
# The latest version of memcached (0.10) doesn't support hostname lookups,
# however, the underlying libmemcached library does. Unfortunately, set_servers
# will raise if a hostname is used, so we overwrite it here.
def set_servers(servers)
[*servers].each_with_index do |server, index|
host, port = server.split(":")
Lib.memcached_server_add(@struct, host, port.to_i)
end
end
end

module ActiveSupport
module Cache
class LibmemcachedStore < Store
Expand Down

0 comments on commit 053f795

Please sign in to comment.