Permalink
Browse files

language changes

  • Loading branch information...
1 parent 34cdeab commit cf175236bce8dc98aec2a5c1989c13ae70977b6e Andrew Cantino committed Apr 10, 2012
Showing with 12 additions and 9 deletions.
  1. +4 −2 README.markdown
  2. +5 −5 lib/morlock/gem_client.rb
  3. +2 −1 lib/morlock/rails.rb
  4. +1 −1 lib/morlock/version.rb
View
@@ -28,7 +28,7 @@ With Bundler:
gem 'morlock', :require => 'morlock/rails'
-Or in any script after Rails has loaded:
+Or in any script:
require 'morlock/rails'
@@ -41,11 +41,13 @@ Possible usages:
handle_failed_lock unless morlock.lock(key) do
# We have the lock
end
-
+
morlock.lock(key) { # We have the lock } || raise "Unable to lock!"
morlock.lock(key, :failure => failure_proc) do
# We have the lock
end
morlock.lock(key, :failure => failure_proc, :success => success_proc)
+
+Morlock doesn't currently do retries, but this could be added in the future. Feel free to submit a patch!
@@ -1,6 +1,6 @@
class Morlock
- class UnknownGemClient < StandardError;
- end
+ class UnknownGemClient < StandardError; end
+
class GemClient
GEM_CLIENTS = []
@@ -18,16 +18,16 @@ def self.wrap(client)
end
end
- raise UnknownGemClient.new("You provided Morlock a memcached client of an unknown type: #{client.class}")
+ raise UnknownGemClient.new("You provided Morlock with a memcached client of an unknown type: #{client.class}")
end
-
def no_server_error(e)
- STDERR.puts "WARNING: No memcached server found; Memlock was unable to create a lock. (#{e.message})"
+ STDERR.puts "WARNING: No memcached server was found; Memlock was unable to create a lock. (#{e.message})"
true
end
end
+
class DalliGemClient < GemClient
def add(key, expiration)
@client.add(key, 1, expiration)
@@ -12,6 +12,8 @@ def morlock
end
end
end
+ else
+ Rails.logger.warn "WARNING: Morlock could not load @data in #setup_for_mem_cache_store. Perhaps we don't yet work with this version of Rails?"
end
end
@@ -39,7 +41,6 @@ def self.detect_memcache_gem
else
Rails.logger.warn "WARNING: Morlock detected that you are not using the Rails ActiveSupport::Cache::MemCacheStore. Rails.morlock will not be setup."
end
-
end
config.after_initialize do
@@ -1,3 +1,3 @@
class Morlock
- VERSION = "0.0.4"
+ VERSION = "0.0.5"
end

0 comments on commit cf17523

Please sign in to comment.