memcached 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v1.4.3. Various convenience methods added to Memcached::Rails (grosser). Retain gemspec. Add Gemfile for convenience.
2
+
1
3
  v1.4.2. Remove race from Marshal.load for any poor saps who have side-effects in their serialization mechanism (jason-o-matic).
2
4
 
3
5
  v1.4.1. Fix Memcached::Rails#servers bug (tomhughes).
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ memcached (1.4.3)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ activesupport (3.2.6)
10
+ i18n (~> 0.6)
11
+ multi_json (~> 1.0)
12
+ allison (2.0.3)
13
+ echoe (4.6.3)
14
+ allison (>= 2.0.3)
15
+ gemcutter (>= 0.7.0)
16
+ rake (>= 0.9.2)
17
+ rdoc (>= 3.6.1)
18
+ rubyforge (>= 2.0.4)
19
+ gemcutter (0.7.1)
20
+ i18n (0.6.0)
21
+ json (1.7.3)
22
+ json_pure (1.7.3)
23
+ metaclass (0.0.1)
24
+ mocha (0.12.0)
25
+ metaclass (~> 0.0.1)
26
+ multi_json (1.3.6)
27
+ rake (0.9.2.2)
28
+ rdoc (3.12)
29
+ json (~> 1.4)
30
+ rubyforge (2.0.4)
31
+ json_pure (>= 1.1.7)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ activesupport
38
+ echoe
39
+ memcached!
40
+ mocha
41
+ rake
data/Manifest CHANGED
@@ -1,5 +1,7 @@
1
1
  BENCHMARKS
2
2
  CHANGELOG
3
+ Gemfile
4
+ Gemfile.lock
3
5
  LICENSE
4
6
  Manifest
5
7
  README.rdoc
@@ -225,6 +227,7 @@ lib/memcached/exceptions.rb
225
227
  lib/memcached/experimental.rb
226
228
  lib/memcached/memcached.rb
227
229
  lib/memcached/rails.rb
230
+ memcached.gemspec
228
231
  test/profile/benchmark.rb
229
232
  test/profile/c_profiler.rb
230
233
  test/profile/exercise.rb
@@ -73,6 +73,12 @@ Note that the API is not the same as that of <b>Ruby-MemCache</b> or <b>memcache
73
73
  $cache.delete 'test'
74
74
  $cache.get 'test' #=> raises Memcached::NotFound
75
75
 
76
+ == Rails
77
+
78
+ # config/environment.rb
79
+ require "memcached/rails"
80
+ config.cache_store = Memcached::Rails.new(:servers => ['127.0.0.1'])
81
+
76
82
  == Pipelining
77
83
 
78
84
  Pipelining updates is extremely effective in <b>memcached</b>, leading to more than 25x write throughput than the default settings. Use the following options to enable it:
data/Rakefile CHANGED
@@ -7,6 +7,8 @@ Echoe.new("memcached") do |p|
7
7
  p.summary = "An interface to the libmemcached C client."
8
8
  p.rdoc_pattern = /README|TODO|LICENSE|CHANGELOG|BENCH|COMPAT|exceptions|experimental.rb|behaviors|rails.rb|memcached.rb/
9
9
  p.rdoc_options = %w[--line-numbers --inline-source --title Memcached --main README.rdoc --exclude=ext/bin --exclude=ext/libmemcached-.*/(clients|tests)]
10
+ p.retain_gemspec = true
11
+ p.development_dependencies = ["rake", "mocha", "echoe", "activesupport"]
10
12
  p.clean_pattern += ["ext/Makefile",
11
13
  "ext/bin",
12
14
  "ext/include",
@@ -85,7 +87,7 @@ task :test_all do
85
87
  with_vms("test")
86
88
  end
87
89
 
88
- task :prerelease => [:test_all]
90
+ task :prerelease => [:test]
89
91
 
90
92
  task :benchmark_all do
91
93
  with_vms("benchmark CLIENT=libm")
@@ -1,3 +1,5 @@
1
+ require 'memcached'
2
+
1
3
  class Memcached
2
4
 
3
5
  (instance_methods - NilClass.instance_methods).each do |method_name|
@@ -95,7 +97,18 @@ class Memcached
95
97
  # Alternative to #set. Accepts a key, value, and an optional options hash supporting the
96
98
  # options :raw and :ttl.
97
99
  def write(key, value, options = {})
98
- set(key, value, options[:ttl] || @default_ttl, options[:raw])
100
+ set(key, value, options[:ttl] || options[:expires_in] || @default_ttl, options[:raw])
101
+ end
102
+
103
+ def fetch(key, options={})
104
+ result = read(key, options)
105
+ if result.nil?
106
+ result = yield
107
+ write(key, result, options)
108
+ result
109
+ else
110
+ result
111
+ end
99
112
  end
100
113
 
101
114
  # Wraps Memcached#add so that it doesn't raise.
@@ -140,10 +153,16 @@ class Memcached
140
153
  end
141
154
 
142
155
  alias :flush_all :flush
156
+ alias :clear :flush
143
157
 
144
158
  alias :"[]" :get
145
159
  alias :"[]=" :set
146
160
 
161
+ def read_multi(*keys)
162
+ return {} if keys.empty?
163
+ get_multi(keys)
164
+ end
165
+
147
166
  # Return an array of server objects.
148
167
  def servers
149
168
  server_structs.each do |server|
@@ -2,22 +2,22 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "memcached"
5
- s.version = "1.4.2"
5
+ s.version = "1.4.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Evan Weaver"]
9
9
  s.cert_chain = ["/Users/eweaver/cloudburst/configuration/gem_certificates/evan_weaver-original-public_cert.pem"]
10
- s.date = "2012-06-09"
10
+ s.date = "2012-07-10"
11
11
  s.description = "An interface to the libmemcached C client."
12
12
  s.email = ""
13
13
  s.extensions = ["ext/extconf.rb"]
14
14
  s.extra_rdoc_files = ["BENCHMARKS", "CHANGELOG", "LICENSE", "README.rdoc", "TODO", "ext/libmemcached-0.32/README", "ext/libmemcached-0.32/TODO", "ext/libmemcached-0.32/libmemcached/memcached/README.txt", "lib/memcached.rb", "lib/memcached/behaviors.rb", "lib/memcached/exceptions.rb", "lib/memcached/experimental.rb", "lib/memcached/memcached.rb", "lib/memcached/rails.rb"]
15
- s.files = ["BENCHMARKS", "CHANGELOG", "LICENSE", "Manifest", "README.rdoc", "Rakefile", "TODO", "ext/extconf-make.rb", "ext/extconf.rb", "ext/libmemcached-0.32/AUTHORS", "ext/libmemcached-0.32/COPYING", "ext/libmemcached-0.32/ChangeLog", "ext/libmemcached-0.32/INSTALL", "ext/libmemcached-0.32/Makefile.am", "ext/libmemcached-0.32/Makefile.in", "ext/libmemcached-0.32/NEWS", "ext/libmemcached-0.32/README", "ext/libmemcached-0.32/THANKS", "ext/libmemcached-0.32/TODO", "ext/libmemcached-0.32/aclocal.m4", "ext/libmemcached-0.32/clients/Makefile.am", "ext/libmemcached-0.32/clients/Makefile.in", "ext/libmemcached-0.32/clients/client_options.h", "ext/libmemcached-0.32/clients/execute.c", "ext/libmemcached-0.32/clients/execute.h", "ext/libmemcached-0.32/clients/generator.c", "ext/libmemcached-0.32/clients/generator.h", "ext/libmemcached-0.32/clients/memcat.c", "ext/libmemcached-0.32/clients/memcp.c", "ext/libmemcached-0.32/clients/memdump.c", "ext/libmemcached-0.32/clients/memerror.c", "ext/libmemcached-0.32/clients/memflush.c", "ext/libmemcached-0.32/clients/memrm.c", "ext/libmemcached-0.32/clients/memslap.c", "ext/libmemcached-0.32/clients/memstat.c", "ext/libmemcached-0.32/clients/utilities.c", "ext/libmemcached-0.32/clients/utilities.h", "ext/libmemcached-0.32/config.h.in", "ext/libmemcached-0.32/config/compile", "ext/libmemcached-0.32/config/config.guess", "ext/libmemcached-0.32/config/config.rpath", "ext/libmemcached-0.32/config/config.sub", "ext/libmemcached-0.32/config/depcomp", "ext/libmemcached-0.32/config/install-sh", "ext/libmemcached-0.32/config/ltmain.sh", "ext/libmemcached-0.32/config/missing", "ext/libmemcached-0.32/configure", "ext/libmemcached-0.32/configure.ac", "ext/libmemcached-0.32/docs/Makefile.am", "ext/libmemcached-0.32/docs/Makefile.in", "ext/libmemcached-0.32/docs/libmemcached.pod", "ext/libmemcached-0.32/docs/libmemcached_examples.pod", "ext/libmemcached-0.32/docs/libmemcachedutil.pod", "ext/libmemcached-0.32/docs/memcached_analyze.pod", "ext/libmemcached-0.32/docs/memcached_auto.pod", "ext/libmemcached-0.32/docs/memcached_behavior.pod", "ext/libmemcached-0.32/docs/memcached_callback.pod", "ext/libmemcached-0.32/docs/memcached_create.pod", "ext/libmemcached-0.32/docs/memcached_delete.pod", "ext/libmemcached-0.32/docs/memcached_dump.pod", "ext/libmemcached-0.32/docs/memcached_flush.pod", "ext/libmemcached-0.32/docs/memcached_flush_buffers.pod", "ext/libmemcached-0.32/docs/memcached_generate_hash_value.pod", "ext/libmemcached-0.32/docs/memcached_get.pod", "ext/libmemcached-0.32/docs/memcached_memory_allocators.pod", "ext/libmemcached-0.32/docs/memcached_pool.pod", "ext/libmemcached-0.32/docs/memcached_quit.pod", "ext/libmemcached-0.32/docs/memcached_sasl.pod", "ext/libmemcached-0.32/docs/memcached_server_st.pod", "ext/libmemcached-0.32/docs/memcached_servers.pod", "ext/libmemcached-0.32/docs/memcached_set.pod", "ext/libmemcached-0.32/docs/memcached_stats.pod", "ext/libmemcached-0.32/docs/memcached_strerror.pod", "ext/libmemcached-0.32/docs/memcached_user_data.pod", "ext/libmemcached-0.32/docs/memcached_verbosity.pod", "ext/libmemcached-0.32/docs/memcached_version.pod", "ext/libmemcached-0.32/docs/memcat.pod", "ext/libmemcached-0.32/docs/memcp.pod", "ext/libmemcached-0.32/docs/memdump.pod", "ext/libmemcached-0.32/docs/memerror.pod", "ext/libmemcached-0.32/docs/memflush.pod", "ext/libmemcached-0.32/docs/memrm.pod", "ext/libmemcached-0.32/docs/memslap.pod", "ext/libmemcached-0.32/docs/memstat.pod", "ext/libmemcached-0.32/libmemcached/Makefile.am", "ext/libmemcached-0.32/libmemcached/Makefile.in", "ext/libmemcached-0.32/libmemcached/byteorder.c", "ext/libmemcached-0.32/libmemcached/common.h", "ext/libmemcached-0.32/libmemcached/crc.c", "ext/libmemcached-0.32/libmemcached/hsieh_hash.c", "ext/libmemcached-0.32/libmemcached/jenkins_hash.c", "ext/libmemcached-0.32/libmemcached/libmemcached.ver", "ext/libmemcached-0.32/libmemcached/libmemcached_probes.d", "ext/libmemcached-0.32/libmemcached/libmemcached_probes.h", "ext/libmemcached-0.32/libmemcached/md5.c", "ext/libmemcached-0.32/libmemcached/memcached.c", "ext/libmemcached-0.32/libmemcached/memcached.h", "ext/libmemcached-0.32/libmemcached/memcached.hpp", "ext/libmemcached-0.32/libmemcached/memcached/README.txt", "ext/libmemcached-0.32/libmemcached/memcached/protocol_binary.h", "ext/libmemcached-0.32/libmemcached/memcached_allocators.c", "ext/libmemcached-0.32/libmemcached/memcached_analyze.c", "ext/libmemcached-0.32/libmemcached/memcached_auto.c", "ext/libmemcached-0.32/libmemcached/memcached_behavior.c", "ext/libmemcached-0.32/libmemcached/memcached_callback.c", "ext/libmemcached-0.32/libmemcached/memcached_configure.h.in", "ext/libmemcached-0.32/libmemcached/memcached_connect.c", "ext/libmemcached-0.32/libmemcached/memcached_constants.h", "ext/libmemcached-0.32/libmemcached/memcached_delete.c", "ext/libmemcached-0.32/libmemcached/memcached_do.c", "ext/libmemcached-0.32/libmemcached/memcached_dump.c", "ext/libmemcached-0.32/libmemcached/memcached_fetch.c", "ext/libmemcached-0.32/libmemcached/memcached_flush.c", "ext/libmemcached-0.32/libmemcached/memcached_flush_buffers.c", "ext/libmemcached-0.32/libmemcached/memcached_get.c", "ext/libmemcached-0.32/libmemcached/memcached_get.h", "ext/libmemcached-0.32/libmemcached/memcached_hash.c", "ext/libmemcached-0.32/libmemcached/memcached_hosts.c", "ext/libmemcached-0.32/libmemcached/memcached_internal.h", "ext/libmemcached-0.32/libmemcached/memcached_io.c", "ext/libmemcached-0.32/libmemcached/memcached_io.h", "ext/libmemcached-0.32/libmemcached/memcached_key.c", "ext/libmemcached-0.32/libmemcached/memcached_parse.c", "ext/libmemcached-0.32/libmemcached/memcached_pool.h", "ext/libmemcached-0.32/libmemcached/memcached_purge.c", "ext/libmemcached-0.32/libmemcached/memcached_quit.c", "ext/libmemcached-0.32/libmemcached/memcached_response.c", "ext/libmemcached-0.32/libmemcached/memcached_result.c", "ext/libmemcached-0.32/libmemcached/memcached_result.h", "ext/libmemcached-0.32/libmemcached/memcached_sasl.c", "ext/libmemcached-0.32/libmemcached/memcached_sasl.h", "ext/libmemcached-0.32/libmemcached/memcached_server.c", "ext/libmemcached-0.32/libmemcached/memcached_server.h", "ext/libmemcached-0.32/libmemcached/memcached_stats.c", "ext/libmemcached-0.32/libmemcached/memcached_storage.c", "ext/libmemcached-0.32/libmemcached/memcached_storage.h", "ext/libmemcached-0.32/libmemcached/memcached_strerror.c", "ext/libmemcached-0.32/libmemcached/memcached_string.c", "ext/libmemcached-0.32/libmemcached/memcached_string.h", "ext/libmemcached-0.32/libmemcached/memcached_touch.c", "ext/libmemcached-0.32/libmemcached/memcached_touch.h", "ext/libmemcached-0.32/libmemcached/memcached_types.h", "ext/libmemcached-0.32/libmemcached/memcached_util.h", "ext/libmemcached-0.32/libmemcached/memcached_verbosity.c", "ext/libmemcached-0.32/libmemcached/memcached_version.c", "ext/libmemcached-0.32/libmemcached/memcached_watchpoint.h", "ext/libmemcached-0.32/libmemcached/murmur_hash.c", "ext/libmemcached-0.32/libmemcached/visibility.h", "ext/libmemcached-0.32/libmemcachedutil/Makefile.am", "ext/libmemcached-0.32/libmemcachedutil/Makefile.in", "ext/libmemcached-0.32/libmemcachedutil/libmemcachedutil.ver", "ext/libmemcached-0.32/libmemcachedutil/memcached_pool.c", "ext/libmemcached-0.32/m4/ac_cxx_compile_stdcxx_0x.m4", "ext/libmemcached-0.32/m4/ac_cxx_header_stdcxx_98.m4", "ext/libmemcached-0.32/m4/aclocal.m4", "ext/libmemcached-0.32/m4/acx_pthread.m4", "ext/libmemcached-0.32/m4/byteorder.m4", "ext/libmemcached-0.32/m4/deprecated.m4", "ext/libmemcached-0.32/m4/enable_utillib.m4", "ext/libmemcached-0.32/m4/extensions.m4", "ext/libmemcached-0.32/m4/hsieh.m4", "ext/libmemcached-0.32/m4/lib-prefix.m4", "ext/libmemcached-0.32/m4/libtool.m4", "ext/libmemcached-0.32/m4/ltoptions.m4", "ext/libmemcached-0.32/m4/ltsugar.m4", "ext/libmemcached-0.32/m4/ltversion.m4", "ext/libmemcached-0.32/m4/lt~obsolete.m4", "ext/libmemcached-0.32/m4/memcached.m4", "ext/libmemcached-0.32/m4/pandora_64bit.m4", "ext/libmemcached-0.32/m4/pandora_canonical.m4", "ext/libmemcached-0.32/m4/pandora_check_compiler_version.m4", "ext/libmemcached-0.32/m4/pandora_check_cxx_standard.m4", "ext/libmemcached-0.32/m4/pandora_enable_dtrace.m4", "ext/libmemcached-0.32/m4/pandora_ensure_gcc_version.m4", "ext/libmemcached-0.32/m4/pandora_have_better_malloc.m4", "ext/libmemcached-0.32/m4/pandora_have_sasl.m4", "ext/libmemcached-0.32/m4/pandora_header_assert.m4", "ext/libmemcached-0.32/m4/pandora_libtool.m4", "ext/libmemcached-0.32/m4/pandora_optimize.m4", "ext/libmemcached-0.32/m4/pandora_shared_ptr.m4", "ext/libmemcached-0.32/m4/pandora_vc_build.m4", "ext/libmemcached-0.32/m4/pandora_warnings.m4", "ext/libmemcached-0.32/m4/pod2man.m4", "ext/libmemcached-0.32/m4/protocol_binary.m4", "ext/libmemcached-0.32/m4/setsockopt.m4", "ext/libmemcached-0.32/m4/visibility.m4", "ext/libmemcached-0.32/support/Makefile.am", "ext/libmemcached-0.32/support/Makefile.in", "ext/libmemcached-0.32/support/libmemcached-fc.spec.in", "ext/libmemcached-0.32/support/libmemcached.pc.in", "ext/libmemcached-0.32/support/libmemcached.spec", "ext/libmemcached-0.32/support/libmemcached.spec.in", "ext/libmemcached-0.32/support/set_benchmark.sh", "ext/libmemcached-0.32/tests/Makefile.am", "ext/libmemcached-0.32/tests/Makefile.in", "ext/libmemcached-0.32/tests/atomsmasher.c", "ext/libmemcached-0.32/tests/function.c", "ext/libmemcached-0.32/tests/ketama_test_cases.h", "ext/libmemcached-0.32/tests/output.cmp", "ext/libmemcached-0.32/tests/output.res", "ext/libmemcached-0.32/tests/output2.res", "ext/libmemcached-0.32/tests/plus.cpp", "ext/libmemcached-0.32/tests/r/memcat.res", "ext/libmemcached-0.32/tests/r/memcp.res", "ext/libmemcached-0.32/tests/r/memrm.res", "ext/libmemcached-0.32/tests/r/memslap.res", "ext/libmemcached-0.32/tests/r/memstat.res", "ext/libmemcached-0.32/tests/server.c", "ext/libmemcached-0.32/tests/server.h", "ext/libmemcached-0.32/tests/start.c", "ext/libmemcached-0.32/tests/t/memcat.test", "ext/libmemcached-0.32/tests/t/memcp.test", "ext/libmemcached-0.32/tests/t/memrm.test", "ext/libmemcached-0.32/tests/t/memslap.test", "ext/libmemcached-0.32/tests/t/memstat.test", "ext/libmemcached-0.32/tests/test.c", "ext/libmemcached-0.32/tests/test.h", "ext/libmemcached-0.32/tests/udp.c", "ext/rlibmemcached.i", "ext/rlibmemcached_wrap.c", "lib/memcached.rb", "lib/memcached/auth.rb", "lib/memcached/behaviors.rb", "lib/memcached/exceptions.rb", "lib/memcached/experimental.rb", "lib/memcached/memcached.rb", "lib/memcached/rails.rb", "test/profile/benchmark.rb", "test/profile/c_profiler.rb", "test/profile/exercise.rb", "test/profile/rb_profiler.rb", "test/profile/valgrind.rb", "test/setup.rb", "test/teardown.rb", "test/test_helper.rb", "test/unit/binding_test.rb", "test/unit/memcached_experimental_test.rb", "test/unit/memcached_test.rb", "test/unit/rails_test.rb", "memcached.gemspec"]
15
+ s.files = ["BENCHMARKS", "CHANGELOG", "Gemfile", "Gemfile.lock", "LICENSE", "Manifest", "README.rdoc", "Rakefile", "TODO", "ext/extconf-make.rb", "ext/extconf.rb", "ext/libmemcached-0.32/AUTHORS", "ext/libmemcached-0.32/COPYING", "ext/libmemcached-0.32/ChangeLog", "ext/libmemcached-0.32/INSTALL", "ext/libmemcached-0.32/Makefile.am", "ext/libmemcached-0.32/Makefile.in", "ext/libmemcached-0.32/NEWS", "ext/libmemcached-0.32/README", "ext/libmemcached-0.32/THANKS", "ext/libmemcached-0.32/TODO", "ext/libmemcached-0.32/aclocal.m4", "ext/libmemcached-0.32/clients/Makefile.am", "ext/libmemcached-0.32/clients/Makefile.in", "ext/libmemcached-0.32/clients/client_options.h", "ext/libmemcached-0.32/clients/execute.c", "ext/libmemcached-0.32/clients/execute.h", "ext/libmemcached-0.32/clients/generator.c", "ext/libmemcached-0.32/clients/generator.h", "ext/libmemcached-0.32/clients/memcat.c", "ext/libmemcached-0.32/clients/memcp.c", "ext/libmemcached-0.32/clients/memdump.c", "ext/libmemcached-0.32/clients/memerror.c", "ext/libmemcached-0.32/clients/memflush.c", "ext/libmemcached-0.32/clients/memrm.c", "ext/libmemcached-0.32/clients/memslap.c", "ext/libmemcached-0.32/clients/memstat.c", "ext/libmemcached-0.32/clients/utilities.c", "ext/libmemcached-0.32/clients/utilities.h", "ext/libmemcached-0.32/config.h.in", "ext/libmemcached-0.32/config/compile", "ext/libmemcached-0.32/config/config.guess", "ext/libmemcached-0.32/config/config.rpath", "ext/libmemcached-0.32/config/config.sub", "ext/libmemcached-0.32/config/depcomp", "ext/libmemcached-0.32/config/install-sh", "ext/libmemcached-0.32/config/ltmain.sh", "ext/libmemcached-0.32/config/missing", "ext/libmemcached-0.32/configure", "ext/libmemcached-0.32/configure.ac", "ext/libmemcached-0.32/docs/Makefile.am", "ext/libmemcached-0.32/docs/Makefile.in", "ext/libmemcached-0.32/docs/libmemcached.pod", "ext/libmemcached-0.32/docs/libmemcached_examples.pod", "ext/libmemcached-0.32/docs/libmemcachedutil.pod", "ext/libmemcached-0.32/docs/memcached_analyze.pod", "ext/libmemcached-0.32/docs/memcached_auto.pod", "ext/libmemcached-0.32/docs/memcached_behavior.pod", "ext/libmemcached-0.32/docs/memcached_callback.pod", "ext/libmemcached-0.32/docs/memcached_create.pod", "ext/libmemcached-0.32/docs/memcached_delete.pod", "ext/libmemcached-0.32/docs/memcached_dump.pod", "ext/libmemcached-0.32/docs/memcached_flush.pod", "ext/libmemcached-0.32/docs/memcached_flush_buffers.pod", "ext/libmemcached-0.32/docs/memcached_generate_hash_value.pod", "ext/libmemcached-0.32/docs/memcached_get.pod", "ext/libmemcached-0.32/docs/memcached_memory_allocators.pod", "ext/libmemcached-0.32/docs/memcached_pool.pod", "ext/libmemcached-0.32/docs/memcached_quit.pod", "ext/libmemcached-0.32/docs/memcached_sasl.pod", "ext/libmemcached-0.32/docs/memcached_server_st.pod", "ext/libmemcached-0.32/docs/memcached_servers.pod", "ext/libmemcached-0.32/docs/memcached_set.pod", "ext/libmemcached-0.32/docs/memcached_stats.pod", "ext/libmemcached-0.32/docs/memcached_strerror.pod", "ext/libmemcached-0.32/docs/memcached_user_data.pod", "ext/libmemcached-0.32/docs/memcached_verbosity.pod", "ext/libmemcached-0.32/docs/memcached_version.pod", "ext/libmemcached-0.32/docs/memcat.pod", "ext/libmemcached-0.32/docs/memcp.pod", "ext/libmemcached-0.32/docs/memdump.pod", "ext/libmemcached-0.32/docs/memerror.pod", "ext/libmemcached-0.32/docs/memflush.pod", "ext/libmemcached-0.32/docs/memrm.pod", "ext/libmemcached-0.32/docs/memslap.pod", "ext/libmemcached-0.32/docs/memstat.pod", "ext/libmemcached-0.32/libmemcached/Makefile.am", "ext/libmemcached-0.32/libmemcached/Makefile.in", "ext/libmemcached-0.32/libmemcached/byteorder.c", "ext/libmemcached-0.32/libmemcached/common.h", "ext/libmemcached-0.32/libmemcached/crc.c", "ext/libmemcached-0.32/libmemcached/hsieh_hash.c", "ext/libmemcached-0.32/libmemcached/jenkins_hash.c", "ext/libmemcached-0.32/libmemcached/libmemcached.ver", "ext/libmemcached-0.32/libmemcached/libmemcached_probes.d", "ext/libmemcached-0.32/libmemcached/libmemcached_probes.h", "ext/libmemcached-0.32/libmemcached/md5.c", "ext/libmemcached-0.32/libmemcached/memcached.c", "ext/libmemcached-0.32/libmemcached/memcached.h", "ext/libmemcached-0.32/libmemcached/memcached.hpp", "ext/libmemcached-0.32/libmemcached/memcached/README.txt", "ext/libmemcached-0.32/libmemcached/memcached/protocol_binary.h", "ext/libmemcached-0.32/libmemcached/memcached_allocators.c", "ext/libmemcached-0.32/libmemcached/memcached_analyze.c", "ext/libmemcached-0.32/libmemcached/memcached_auto.c", "ext/libmemcached-0.32/libmemcached/memcached_behavior.c", "ext/libmemcached-0.32/libmemcached/memcached_callback.c", "ext/libmemcached-0.32/libmemcached/memcached_configure.h.in", "ext/libmemcached-0.32/libmemcached/memcached_connect.c", "ext/libmemcached-0.32/libmemcached/memcached_constants.h", "ext/libmemcached-0.32/libmemcached/memcached_delete.c", "ext/libmemcached-0.32/libmemcached/memcached_do.c", "ext/libmemcached-0.32/libmemcached/memcached_dump.c", "ext/libmemcached-0.32/libmemcached/memcached_fetch.c", "ext/libmemcached-0.32/libmemcached/memcached_flush.c", "ext/libmemcached-0.32/libmemcached/memcached_flush_buffers.c", "ext/libmemcached-0.32/libmemcached/memcached_get.c", "ext/libmemcached-0.32/libmemcached/memcached_get.h", "ext/libmemcached-0.32/libmemcached/memcached_hash.c", "ext/libmemcached-0.32/libmemcached/memcached_hosts.c", "ext/libmemcached-0.32/libmemcached/memcached_internal.h", "ext/libmemcached-0.32/libmemcached/memcached_io.c", "ext/libmemcached-0.32/libmemcached/memcached_io.h", "ext/libmemcached-0.32/libmemcached/memcached_key.c", "ext/libmemcached-0.32/libmemcached/memcached_parse.c", "ext/libmemcached-0.32/libmemcached/memcached_pool.h", "ext/libmemcached-0.32/libmemcached/memcached_purge.c", "ext/libmemcached-0.32/libmemcached/memcached_quit.c", "ext/libmemcached-0.32/libmemcached/memcached_response.c", "ext/libmemcached-0.32/libmemcached/memcached_result.c", "ext/libmemcached-0.32/libmemcached/memcached_result.h", "ext/libmemcached-0.32/libmemcached/memcached_sasl.c", "ext/libmemcached-0.32/libmemcached/memcached_sasl.h", "ext/libmemcached-0.32/libmemcached/memcached_server.c", "ext/libmemcached-0.32/libmemcached/memcached_server.h", "ext/libmemcached-0.32/libmemcached/memcached_stats.c", "ext/libmemcached-0.32/libmemcached/memcached_storage.c", "ext/libmemcached-0.32/libmemcached/memcached_storage.h", "ext/libmemcached-0.32/libmemcached/memcached_strerror.c", "ext/libmemcached-0.32/libmemcached/memcached_string.c", "ext/libmemcached-0.32/libmemcached/memcached_string.h", "ext/libmemcached-0.32/libmemcached/memcached_touch.c", "ext/libmemcached-0.32/libmemcached/memcached_touch.h", "ext/libmemcached-0.32/libmemcached/memcached_types.h", "ext/libmemcached-0.32/libmemcached/memcached_util.h", "ext/libmemcached-0.32/libmemcached/memcached_verbosity.c", "ext/libmemcached-0.32/libmemcached/memcached_version.c", "ext/libmemcached-0.32/libmemcached/memcached_watchpoint.h", "ext/libmemcached-0.32/libmemcached/murmur_hash.c", "ext/libmemcached-0.32/libmemcached/visibility.h", "ext/libmemcached-0.32/libmemcachedutil/Makefile.am", "ext/libmemcached-0.32/libmemcachedutil/Makefile.in", "ext/libmemcached-0.32/libmemcachedutil/libmemcachedutil.ver", "ext/libmemcached-0.32/libmemcachedutil/memcached_pool.c", "ext/libmemcached-0.32/m4/ac_cxx_compile_stdcxx_0x.m4", "ext/libmemcached-0.32/m4/ac_cxx_header_stdcxx_98.m4", "ext/libmemcached-0.32/m4/aclocal.m4", "ext/libmemcached-0.32/m4/acx_pthread.m4", "ext/libmemcached-0.32/m4/byteorder.m4", "ext/libmemcached-0.32/m4/deprecated.m4", "ext/libmemcached-0.32/m4/enable_utillib.m4", "ext/libmemcached-0.32/m4/extensions.m4", "ext/libmemcached-0.32/m4/hsieh.m4", "ext/libmemcached-0.32/m4/lib-prefix.m4", "ext/libmemcached-0.32/m4/libtool.m4", "ext/libmemcached-0.32/m4/ltoptions.m4", "ext/libmemcached-0.32/m4/ltsugar.m4", "ext/libmemcached-0.32/m4/ltversion.m4", "ext/libmemcached-0.32/m4/lt~obsolete.m4", "ext/libmemcached-0.32/m4/memcached.m4", "ext/libmemcached-0.32/m4/pandora_64bit.m4", "ext/libmemcached-0.32/m4/pandora_canonical.m4", "ext/libmemcached-0.32/m4/pandora_check_compiler_version.m4", "ext/libmemcached-0.32/m4/pandora_check_cxx_standard.m4", "ext/libmemcached-0.32/m4/pandora_enable_dtrace.m4", "ext/libmemcached-0.32/m4/pandora_ensure_gcc_version.m4", "ext/libmemcached-0.32/m4/pandora_have_better_malloc.m4", "ext/libmemcached-0.32/m4/pandora_have_sasl.m4", "ext/libmemcached-0.32/m4/pandora_header_assert.m4", "ext/libmemcached-0.32/m4/pandora_libtool.m4", "ext/libmemcached-0.32/m4/pandora_optimize.m4", "ext/libmemcached-0.32/m4/pandora_shared_ptr.m4", "ext/libmemcached-0.32/m4/pandora_vc_build.m4", "ext/libmemcached-0.32/m4/pandora_warnings.m4", "ext/libmemcached-0.32/m4/pod2man.m4", "ext/libmemcached-0.32/m4/protocol_binary.m4", "ext/libmemcached-0.32/m4/setsockopt.m4", "ext/libmemcached-0.32/m4/visibility.m4", "ext/libmemcached-0.32/support/Makefile.am", "ext/libmemcached-0.32/support/Makefile.in", "ext/libmemcached-0.32/support/libmemcached-fc.spec.in", "ext/libmemcached-0.32/support/libmemcached.pc.in", "ext/libmemcached-0.32/support/libmemcached.spec", "ext/libmemcached-0.32/support/libmemcached.spec.in", "ext/libmemcached-0.32/support/set_benchmark.sh", "ext/libmemcached-0.32/tests/Makefile.am", "ext/libmemcached-0.32/tests/Makefile.in", "ext/libmemcached-0.32/tests/atomsmasher.c", "ext/libmemcached-0.32/tests/function.c", "ext/libmemcached-0.32/tests/ketama_test_cases.h", "ext/libmemcached-0.32/tests/output.cmp", "ext/libmemcached-0.32/tests/output.res", "ext/libmemcached-0.32/tests/output2.res", "ext/libmemcached-0.32/tests/plus.cpp", "ext/libmemcached-0.32/tests/r/memcat.res", "ext/libmemcached-0.32/tests/r/memcp.res", "ext/libmemcached-0.32/tests/r/memrm.res", "ext/libmemcached-0.32/tests/r/memslap.res", "ext/libmemcached-0.32/tests/r/memstat.res", "ext/libmemcached-0.32/tests/server.c", "ext/libmemcached-0.32/tests/server.h", "ext/libmemcached-0.32/tests/start.c", "ext/libmemcached-0.32/tests/t/memcat.test", "ext/libmemcached-0.32/tests/t/memcp.test", "ext/libmemcached-0.32/tests/t/memrm.test", "ext/libmemcached-0.32/tests/t/memslap.test", "ext/libmemcached-0.32/tests/t/memstat.test", "ext/libmemcached-0.32/tests/test.c", "ext/libmemcached-0.32/tests/test.h", "ext/libmemcached-0.32/tests/udp.c", "ext/rlibmemcached.i", "ext/rlibmemcached_wrap.c", "lib/memcached.rb", "lib/memcached/auth.rb", "lib/memcached/behaviors.rb", "lib/memcached/exceptions.rb", "lib/memcached/experimental.rb", "lib/memcached/memcached.rb", "lib/memcached/rails.rb", "memcached.gemspec", "test/profile/benchmark.rb", "test/profile/c_profiler.rb", "test/profile/exercise.rb", "test/profile/rb_profiler.rb", "test/profile/valgrind.rb", "test/setup.rb", "test/teardown.rb", "test/test_helper.rb", "test/unit/binding_test.rb", "test/unit/memcached_experimental_test.rb", "test/unit/memcached_test.rb", "test/unit/rails_test.rb"]
16
16
  s.homepage = "http://evan.github.com/evan/memcached/"
17
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Memcached", "--main", "README.rdoc", "--exclude=ext/bin", "--exclude=ext/libmemcached-.*/(clients|tests)"]
18
18
  s.require_paths = ["lib", "ext"]
19
19
  s.rubyforge_project = "evan"
20
- s.rubygems_version = "1.8.11"
20
+ s.rubygems_version = "1.8.24"
21
21
  s.signing_key = "/Users/eweaver/cloudburst/configuration/gem_certificates/evan_weaver-original-private_key.pem"
22
22
  s.summary = "An interface to the libmemcached C client."
23
23
  s.test_files = ["test/test_helper.rb", "test/unit/binding_test.rb", "test/unit/memcached_experimental_test.rb", "test/unit/memcached_test.rb", "test/unit/rails_test.rb"]
@@ -26,8 +26,20 @@ Gem::Specification.new do |s|
26
26
  s.specification_version = 3
27
27
 
28
28
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
29
+ s.add_development_dependency(%q<rake>, [">= 0"])
30
+ s.add_development_dependency(%q<mocha>, [">= 0"])
31
+ s.add_development_dependency(%q<echoe>, [">= 0"])
32
+ s.add_development_dependency(%q<activesupport>, [">= 0"])
29
33
  else
34
+ s.add_dependency(%q<rake>, [">= 0"])
35
+ s.add_dependency(%q<mocha>, [">= 0"])
36
+ s.add_dependency(%q<echoe>, [">= 0"])
37
+ s.add_dependency(%q<activesupport>, [">= 0"])
30
38
  end
31
39
  else
40
+ s.add_dependency(%q<rake>, [">= 0"])
41
+ s.add_dependency(%q<mocha>, [">= 0"])
42
+ s.add_dependency(%q<echoe>, [">= 0"])
43
+ s.add_dependency(%q<activesupport>, [">= 0"])
32
44
  end
33
45
  end
@@ -1,4 +1,3 @@
1
-
2
1
  require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
3
2
  require 'active_support/duration'
4
3
 
@@ -163,10 +162,38 @@ class RailsTest < Test::Unit::TestCase
163
162
  end
164
163
  end
165
164
 
166
- def test_write_with_duration
167
- @cache.write key, @value, :ttl => @duration
165
+ def test_write_with_default_duration
166
+ # should be do an actual write
167
+ @cache.write key, @value
168
168
  result = @cache.get key
169
169
  assert_equal @value, result
170
+
171
+ # should use correct ttl
172
+ @cache = Memcached::Rails.new(:servers => @servers, :namespace => @namespace, :default_ttl => 123)
173
+ @cache.expects(:set).with(key, @value, 123, nil)
174
+ @cache.write key, @value
175
+ end
176
+
177
+ def test_write_with_duration_as_ttl
178
+ # should be do an actual write
179
+ @cache.write key, @value, :ttl => 123
180
+ result = @cache.get key
181
+ assert_equal @value, result
182
+
183
+ # should use correct ttl
184
+ @cache.expects(:set).with(key, @value, 123, nil)
185
+ @cache.write key, @value, :ttl => 123
186
+ end
187
+
188
+ def test_write_with_duration_as_expires_in
189
+ # should be do an actual write
190
+ @cache.write key, @value, :expires_in => @duration
191
+ result = @cache.get key
192
+ assert_equal @value, result
193
+
194
+ # should use correct ttl
195
+ @cache.expects(:set).with(key, @value, 123, nil)
196
+ @cache.write key, @value, :expires_in => 123
170
197
  end
171
198
 
172
199
  def test_add_with_duration
@@ -175,6 +202,52 @@ class RailsTest < Test::Unit::TestCase
175
202
  assert_equal @value, result
176
203
  end
177
204
 
205
+ def test_fetch
206
+ # returns
207
+ assert_equal @value, @cache.fetch("x"){ @value }
208
+
209
+ # sets
210
+ assert_equal @value, @cache.read("x")
211
+
212
+ # reads
213
+ assert_equal @value, @cache.fetch("x"){ 1 }
214
+
215
+ # works with options
216
+ @cache.expects(:write).with("y", 1, :foo => :bar)
217
+ @cache.fetch("y", :foo => :bar){ 1 }
218
+ end
219
+
220
+ def test_read_multi
221
+ # empty
222
+ assert_equal({}, @cache.read_multi)
223
+ assert_equal({}, @cache.read_multi("a", "b"))
224
+ assert_raise TypeError do
225
+ @cache.read_multi(["a", "b"])
226
+ end
227
+
228
+ # filled
229
+ @cache.write "a", @value
230
+ assert_equal({"a" => @value}, @cache.read_multi("a", "b"))
231
+ assert_raise TypeError do
232
+ @cache.read_multi(["a", "b"])
233
+ end
234
+
235
+ # multiple keys
236
+ @cache.write "b", 1
237
+ assert_equal({"a" => @value, "b" => 1}, @cache.read_multi("a", "b"))
238
+
239
+ # keeps order
240
+ assert_equal ["a", "b"], @cache.read_multi("a", "b").keys
241
+ assert_equal ["b", "a"], @cache.read_multi("b", "a").keys
242
+ end
243
+
244
+ def test_clear
245
+ @cache.write("x", 1)
246
+ assert_equal 1, @cache.read("x")
247
+ assert_equal nil, @cache.clear
248
+ assert_equal nil, @cache.read("x")
249
+ end
250
+
178
251
  private
179
252
 
180
253
  def key
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memcached
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,8 +36,72 @@ cert_chain:
36
36
  QUMzSFJXWnhJUzFzZm4vU3NxYTdFN29RTWt2NUZBWHIKeDVyS2VQZlhJTmY4
37
37
  WFRKY3prbDlPQkVZZEU5YU5kSnNKcFhEMGFzTGdHVndCSUNTNUJqb2hwNm1p
38
38
  ekpjREMxKwp5WjA9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
39
- date: 2012-06-09 00:00:00.000000000 Z
40
- dependencies: []
39
+ date: 2012-07-10 00:00:00.000000000 Z
40
+ dependencies:
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: mocha
59
+ requirement: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ - !ruby/object:Gem::Dependency
74
+ name: echoe
75
+ requirement: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ type: :development
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: activesupport
91
+ requirement: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
41
105
  description: An interface to the libmemcached C client.
42
106
  email: ''
43
107
  executables: []
@@ -61,6 +125,8 @@ extra_rdoc_files:
61
125
  files:
62
126
  - BENCHMARKS
63
127
  - CHANGELOG
128
+ - Gemfile
129
+ - Gemfile.lock
64
130
  - LICENSE
65
131
  - Manifest
66
132
  - README.rdoc
@@ -286,6 +352,7 @@ files:
286
352
  - lib/memcached/experimental.rb
287
353
  - lib/memcached/memcached.rb
288
354
  - lib/memcached/rails.rb
355
+ - memcached.gemspec
289
356
  - test/profile/benchmark.rb
290
357
  - test/profile/c_profiler.rb
291
358
  - test/profile/exercise.rb
@@ -298,7 +365,6 @@ files:
298
365
  - test/unit/memcached_experimental_test.rb
299
366
  - test/unit/memcached_test.rb
300
367
  - test/unit/rails_test.rb
301
- - memcached.gemspec
302
368
  homepage: http://evan.github.com/evan/memcached/
303
369
  licenses: []
304
370
  post_install_message:
@@ -328,7 +394,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
394
  version: '1.2'
329
395
  requirements: []
330
396
  rubyforge_project: evan
331
- rubygems_version: 1.8.11
397
+ rubygems_version: 1.8.24
332
398
  signing_key:
333
399
  specification_version: 3
334
400
  summary: An interface to the libmemcached C client.
metadata.gz.sig CHANGED
Binary file