dalli 1.1.4 → 2.7.11

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of dalli might be problematic. Click here for more details.

metadata CHANGED
@@ -1,138 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dalli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
5
- prerelease:
4
+ version: 2.7.11
6
5
  platform: ruby
7
6
  authors:
7
+ - Peter M. Goldstein
8
8
  - Mike Perham
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-11 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: shoulda
16
- requirement: &70233391291560 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
- prerelease: false
24
- version_requirements: *70233391291560
25
- - !ruby/object:Gem::Dependency
26
- name: mocha
27
- requirement: &70233391290560 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :development
34
- prerelease: false
35
- version_requirements: *70233391290560
36
- - !ruby/object:Gem::Dependency
37
- name: rails
38
- requirement: &70233391290000 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: 3.0.0
44
- type: :development
45
- prerelease: false
46
- version_requirements: *70233391290000
47
- - !ruby/object:Gem::Dependency
48
- name: memcache-client
49
- requirement: &70233391289240 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: 1.8.5
55
- type: :development
56
- prerelease: false
57
- version_requirements: *70233391289240
12
+ date: 2020-09-26 00:00:00.000000000 Z
13
+ dependencies: []
58
14
  description: High performance memcached client for Ruby
59
- email: mperham@gmail.com
15
+ email:
16
+ - peter.m.goldstein@gmail.com
17
+ - mperham@gmail.com
60
18
  executables: []
61
19
  extensions: []
62
20
  extra_rdoc_files: []
63
21
  files:
22
+ - Gemfile
23
+ - History.md
24
+ - LICENSE
25
+ - README.md
64
26
  - lib/action_dispatch/middleware/session/dalli_store.rb
65
27
  - lib/active_support/cache/dalli_store.rb
66
- - lib/active_support/cache/dalli_store23.rb
28
+ - lib/dalli.rb
29
+ - lib/dalli/cas/client.rb
67
30
  - lib/dalli/client.rb
68
- - lib/dalli/compatibility.rb
69
- - lib/dalli/memcache-client.rb
31
+ - lib/dalli/compressor.rb
70
32
  - lib/dalli/options.rb
33
+ - lib/dalli/railtie.rb
71
34
  - lib/dalli/ring.rb
72
35
  - lib/dalli/server.rb
73
36
  - lib/dalli/socket.rb
74
37
  - lib/dalli/version.rb
75
- - lib/dalli.rb
76
38
  - lib/rack/session/dalli.rb
77
- - LICENSE
78
- - README.md
79
- - History.md
80
- - Rakefile
81
- - Gemfile
82
- - dalli.gemspec
83
- - Performance.md
84
- - Upgrade.md
85
- - test/abstract_unit.rb
86
- - test/benchmark_test.rb
87
- - test/helper.rb
88
- - test/memcached_mock.rb
89
- - test/test_active_support.rb
90
- - test/test_compatibility.rb
91
- - test/test_dalli.rb
92
- - test/test_encoding.rb
93
- - test/test_failover.rb
94
- - test/test_network.rb
95
- - test/test_ring.rb
96
- - test/test_sasl.rb
97
- - test/test_session_store.rb
98
- - test/test_synchrony.rb
99
- homepage: http://github.com/mperham/dalli
100
- licenses: []
101
- post_install_message:
102
- rdoc_options:
103
- - --charset=UTF-8
39
+ homepage: https://github.com/petergoldstein/dalli
40
+ licenses:
41
+ - MIT
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
104
45
  require_paths:
105
46
  - lib
106
47
  required_ruby_version: !ruby/object:Gem::Requirement
107
- none: false
108
48
  requirements:
109
- - - ! '>='
49
+ - - ">="
110
50
  - !ruby/object:Gem::Version
111
51
  version: '0'
112
52
  required_rubygems_version: !ruby/object:Gem::Requirement
113
- none: false
114
53
  requirements:
115
- - - ! '>='
54
+ - - ">="
116
55
  - !ruby/object:Gem::Version
117
56
  version: '0'
118
57
  requirements: []
119
- rubyforge_project:
120
- rubygems_version: 1.8.10
121
- signing_key:
122
- specification_version: 3
58
+ rubyforge_project:
59
+ rubygems_version: 2.7.6.2
60
+ signing_key:
61
+ specification_version: 4
123
62
  summary: High performance memcached client for Ruby
124
- test_files:
125
- - test/abstract_unit.rb
126
- - test/benchmark_test.rb
127
- - test/helper.rb
128
- - test/memcached_mock.rb
129
- - test/test_active_support.rb
130
- - test/test_compatibility.rb
131
- - test/test_dalli.rb
132
- - test/test_encoding.rb
133
- - test/test_failover.rb
134
- - test/test_network.rb
135
- - test/test_ring.rb
136
- - test/test_sasl.rb
137
- - test/test_session_store.rb
138
- - test/test_synchrony.rb
63
+ test_files: []
data/Performance.md DELETED
@@ -1,85 +0,0 @@
1
- Performance
2
- ====================
3
-
4
- Caching is all about performance, so I carefully track Dalli performance to ensure no regressions.
5
- Times are from a Unibody MBP 2.4Ghz Core i5 running Snow Leopard.
6
-
7
- You can optionally use kgio to give Dalli a small, 10-20% performance boost: gem install kgio.
8
-
9
- memcache-client
10
- ---------------
11
-
12
- Testing 1.8.5 with ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]
13
-
14
- user system total real
15
- set:plain:memcache 2.070000 0.340000 2.410000 ( 2.611709)
16
- set:ruby:memcache 1.990000 0.330000 2.320000 ( 2.869653)
17
- get:plain:memcache 2.290000 0.360000 2.650000 ( 2.926425)
18
- get:ruby:memcache 2.360000 0.350000 2.710000 ( 2.951604)
19
- multiget:ruby:memcache 1.050000 0.120000 1.170000 ( 1.285787)
20
- missing:ruby:memcache 1.990000 0.330000 2.320000 ( 2.567641)
21
- mixed:ruby:memcache 4.390000 0.670000 5.060000 ( 5.721000)
22
- incr:ruby:memcache 0.700000 0.120000 0.820000 ( 0.842896)
23
-
24
- libmemcached
25
- ------------
26
-
27
- Testing 1.1.2 with ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]
28
-
29
- user system total real
30
- set:plain:libm 0.120000 0.220000 0.340000 ( 0.847521)
31
- setq:plain:libm 0.030000 0.000000 0.030000 ( 0.126944)
32
- set:ruby:libm 0.220000 0.250000 0.470000 ( 1.102789)
33
- get:plain:libm 0.140000 0.230000 0.370000 ( 0.813998)
34
- get:ruby:libm 0.210000 0.240000 0.450000 ( 1.025994)
35
- multiget:ruby:libm 0.100000 0.080000 0.180000 ( 0.322217)
36
- missing:ruby:libm 0.250000 0.240000 0.490000 ( 1.049972)
37
- mixed:ruby:libm 0.400000 0.410000 0.810000 ( 2.172349)
38
- mixedq:ruby:libm 0.410000 0.360000 0.770000 ( 1.516718)
39
- incr:ruby:libm 0.080000 0.340000 0.420000 ( 1.685931)
40
-
41
- dalli
42
- -----
43
-
44
- Using kgio socket IO
45
- Testing 1.0.2 with ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]
46
-
47
- user system total real
48
- set:plain:dalli 0.850000 0.320000 1.170000 ( 1.691393)
49
- setq:plain:dalli 0.500000 0.130000 0.630000 ( 0.651227)
50
- set:ruby:dalli 0.900000 0.330000 1.230000 ( 1.865228)
51
- get:plain:dalli 0.990000 0.390000 1.380000 ( 1.929994)
52
- get:ruby:dalli 0.950000 0.370000 1.320000 ( 1.844251)
53
- multiget:ruby:dalli 0.790000 0.300000 1.090000 ( 1.227073)
54
- missing:ruby:dalli 0.810000 0.370000 1.180000 ( 1.627039)
55
- mixed:ruby:dalli 1.850000 0.710000 2.560000 ( 3.555032)
56
- mixedq:ruby:dalli 1.840000 0.610000 2.450000 ( 2.945982)
57
- incr:ruby:dalli 0.310000 0.120000 0.430000 ( 0.616465)
58
-
59
- Testing 1.0.2 with rubinius 1.3.0dev (1.8.7 382e813f xxxx-xx-xx JI) [x86_64-apple-darwin10.6.0]
60
-
61
- user system total real
62
- set:plain:dalli 2.800581 0.329360 3.129941 ( 5.186546)
63
- setq:plain:dalli 1.064253 0.138044 1.202297 ( 1.280355)
64
- set:ruby:dalli 2.220885 0.262619 2.483504 ( 2.778118)
65
- get:plain:dalli 2.291344 0.280490 2.571834 ( 2.948004)
66
- get:ruby:dalli 2.148900 0.274477 2.423377 ( 2.425808)
67
- multiget:ruby:dalli 1.724193 0.249145 1.973338 ( 2.158673)
68
- missing:ruby:dalli 1.881502 0.272610 2.154112 ( 2.208384)
69
- mixed:ruby:dalli 4.292620 0.533768 4.826388 ( 4.830238)
70
- mixedq:ruby:dalli 4.076032 0.501442 4.577474 ( 4.583800)
71
- incr:ruby:dalli 0.691467 0.091475 0.782942 ( 0.931674)
72
-
73
- Testing 1.0.2 with rubinius 1.2.0 (1.8.7 release 2010-12-21 JI) [x86_64-apple-darwin10.6.0]
74
-
75
- user system total real
76
- set:plain:dalli 6.586927 0.331545 6.918472 ( 4.628652)
77
- setq:plain:dalli 0.930905 0.129008 1.059913 ( 1.016105)
78
- set:ruby:dalli 2.702486 0.283004 2.985490 ( 2.690442)
79
- get:plain:dalli 2.740202 0.291353 3.031555 ( 2.722746)
80
- get:ruby:dalli 1.979379 0.282986 2.262365 ( 2.264118)
81
- multiget:ruby:dalli 1.887086 0.249799 2.136885 ( 1.803230)
82
- missing:ruby:dalli 1.882662 0.278019 2.160681 ( 2.113429)
83
- mixed:ruby:dalli 3.969242 0.553361 4.522603 ( 4.524504)
84
- mixedq:ruby:dalli 3.520755 0.475669 3.996424 ( 3.997405)
85
- incr:ruby:dalli 0.849998 0.094012 0.944010 ( 0.884001)
data/Rakefile DELETED
@@ -1,39 +0,0 @@
1
- require 'rake/testtask'
2
- Rake::TestTask.new(:test) do |test|
3
- test.libs << 'test'
4
- test.pattern = 'test/**/test_*.rb'
5
- end
6
-
7
- Rake::TestTask.new(:bench) do |test|
8
- test.libs << 'test'
9
- test.pattern = 'test/benchmark_test.rb'
10
- end
11
-
12
- begin
13
- require 'metric_fu'
14
- MetricFu::Configuration.run do |config|
15
- config.rcov[:rcov_opts] << "-Itest:lib"
16
- end
17
- rescue LoadError
18
- end
19
-
20
- task :default => :test
21
-
22
- task :test_all do
23
- system('rake test RAILS_VERSION="~> 3.0.0"')
24
- system('rake test RAILS_VERSION=">= 3.0.0"')
25
- end
26
-
27
- # 'gem install rdoc' to upgrade RDoc if this is giving you errors
28
- begin
29
- require 'rdoc/task'
30
- RDoc::Task.new do |rd|
31
- rd.rdoc_files.include("lib/**/*.rb")
32
- end
33
- rescue LoadError
34
- puts "Unable to load rdoc, run 'gem install rdoc' to fix this."
35
- end
36
-
37
- require 'rake/clean'
38
- CLEAN.include "**/*.rbc"
39
- CLEAN.include "**/.DS_Store"
data/Upgrade.md DELETED
@@ -1,45 +0,0 @@
1
- Upgrading from memcache-client
2
- ========
3
-
4
- Dalli is not meant to be 100% compatible with memcache-client, there are a few minor differences in the API.
5
-
6
-
7
- Compatibility Layer
8
- ----------------------
9
-
10
- Enable memcache-client compatibility in your application when upgrading by requiring this when
11
- initalizing your app:
12
-
13
- require 'dalli/memcache-client'
14
-
15
- This will print out warnings if your code is using the old memcache-client API style, explained below.
16
-
17
-
18
- Marshalling
19
- ---------------
20
-
21
- Dalli has changed the raw parameter to a :raw option. The memcache-client API allowed you to control marshalling on a per-method basis using a boolean 'raw' parameter to several of the API methods:
22
-
23
- cache = MemCache.new
24
- cache.set('abc', 123, 0, true)
25
- cache.get('abc', true) => '123'
26
-
27
- cache.set('abc', 123, 0)
28
- cache.get('abc') => 123
29
-
30
- Note that the last parameter is set to true in the first two API calls and so `get` returns a string, not an integer. In the second example, we don't provide the raw parameter. Since it defaults to false, it works exactly like Dalli.
31
-
32
- If the code specifies raw as false, you can simply remove that parameter. If the code is using raw = true, you will need to use the :raw option:
33
-
34
- cache.set('abc', 123, 0, :raw => true)
35
-
36
-
37
- Return Values
38
- ----------------
39
-
40
- In memcache-client, `set(key, value)` normally returns "STORED\r\n". This is an artifact of the text protocol used in earlier versions of memcached. Code that checks the return value will need to be updated. Dalli raises errors for exceptional cases but otherwise returns true or false depending on whether the operation succeeded or not. These methods are affected:
41
-
42
- set
43
- add
44
- replace
45
- delete
data/dalli.gemspec DELETED
@@ -1,31 +0,0 @@
1
- require './lib/dalli/version'
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{dalli}
5
- s.version = Dalli::VERSION
6
-
7
- s.authors = ["Mike Perham"]
8
- s.date = Time.now.utc.strftime("%Y-%m-%d")
9
- s.description = %q{High performance memcached client for Ruby}
10
- s.email = %q{mperham@gmail.com}
11
- s.files = Dir.glob("lib/**/*") + [
12
- "LICENSE",
13
- "README.md",
14
- "History.md",
15
- "Rakefile",
16
- "Gemfile",
17
- "dalli.gemspec",
18
- "Performance.md",
19
- "Upgrade.md",
20
- ]
21
- s.homepage = %q{http://github.com/mperham/dalli}
22
- s.rdoc_options = ["--charset=UTF-8"]
23
- s.require_paths = ["lib"]
24
- s.summary = %q{High performance memcached client for Ruby}
25
- s.test_files = Dir.glob("test/**/*")
26
- s.add_development_dependency(%q<shoulda>, [">= 0"])
27
- s.add_development_dependency(%q<mocha>, [">= 0"])
28
- s.add_development_dependency(%q<rails>, [">= 3.0.0"])
29
- s.add_development_dependency(%q<memcache-client>, [">= 1.8.5"])
30
- end
31
-
@@ -1,172 +0,0 @@
1
- begin
2
- require 'dalli'
3
- rescue LoadError => e
4
- $stderr.puts "You don't have dalli installed in your application: #{e.message}"
5
- raise e
6
- end
7
- require 'digest/md5'
8
-
9
- module ActiveSupport
10
- module Cache
11
- # A cache store implementation which stores data in Memcached:
12
- # http://www.danga.com/memcached/
13
- #
14
- # DalliStore implements the Strategy::LocalCache strategy which implements
15
- # an in memory cache inside of a block.
16
- class DalliStore < Store
17
-
18
- def self.build_mem_cache(*addresses)
19
- addresses = addresses.flatten
20
- options = addresses.extract_options!
21
- addresses = ["localhost"] if addresses.empty?
22
- Dalli::Client.new(addresses, options)
23
- end
24
-
25
- # Creates a new DalliStore object, with the given memcached server
26
- # addresses. Each address is either a host name, or a host-with-port string
27
- # in the form of "host_name:port". For example:
28
- #
29
- # ActiveSupport::Cache::DalliStore.new("localhost", "server-downstairs.localnetwork:8229")
30
- #
31
- # If no addresses are specified, then DalliStore will connect to
32
- # localhost port 11211 (the default memcached port).
33
- #
34
- def initialize(*addresses)
35
- addresses = addresses.flatten
36
- options = addresses.extract_options!
37
-
38
- mem_cache_options = options.dup
39
- @namespace = mem_cache_options.delete(:namespace)
40
- @expires_in = mem_cache_options[:expires_in]
41
- @data = self.class.build_mem_cache(*(addresses + [mem_cache_options]))
42
-
43
- extend Strategy::LocalCache
44
- end
45
-
46
- # Reads multiple keys from the cache using a single call to the
47
- # servers for all keys. Options can be passed in the last argument.
48
- def read_multi(*names)
49
- options = nil
50
- options = names.pop if names.last.is_a?(Hash)
51
- keys_to_names = names.inject({}){|map, name| map[escape_key(name)] = name; map}
52
- cache_keys = {}
53
- # map keys to servers
54
- names.each do |key|
55
- cache_key = escape_key key
56
- cache_keys[cache_key] = key
57
- end
58
-
59
- values = @data.get_multi(keys_to_names.keys, options)
60
- results = {}
61
- values.each do |key, value|
62
- results[cache_keys[key]] = value
63
- end
64
- results
65
- end
66
-
67
- def reset
68
- @data.reset
69
- end
70
-
71
- # Read an entry from the cache.
72
- def read(key, options = nil) # :nodoc:
73
- super
74
- @data.get(escape_key(key), options)
75
- rescue Dalli::DalliError => e
76
- logger.error("DalliError: #{e.message}")
77
- nil
78
- end
79
-
80
- # Writes a value to the cache.
81
- #
82
- # Possible options:
83
- # - +:unless_exist+ - set to true if you don't want to update the cache
84
- # if the key is already set.
85
- # - +:expires_in+ - the number of seconds that this value may stay in
86
- # the cache. See ActiveSupport::Cache::Store#write for an example.
87
- def write(key, value, options = nil)
88
- super
89
- value = value.to_s if options && options[:raw]
90
- method = options && options[:unless_exist] ? :add : :set
91
- @data.send(method, escape_key(key), value, expires_in(options), options)
92
- rescue Dalli::DalliError => e
93
- logger.error("DalliError: #{e.message}")
94
- false
95
- end
96
-
97
- def delete(key, options = nil) # :nodoc:
98
- super
99
- @data.delete(escape_key(key))
100
- rescue Dalli::DalliError => e
101
- logger.error("DalliError: #{e.message}")
102
- false
103
- end
104
-
105
- def exist?(key, options = nil) # :nodoc:
106
- # Doesn't call super, cause exist? in memcache is in fact a read
107
- # But who cares? Reading is very fast anyway
108
- # Local cache is checked first, if it doesn't know then memcache itself is read from
109
- !read(key, options).nil?
110
- end
111
-
112
- # Increment a cached value. This method uses the memcached incr atomic
113
- # operator and can only be used on values written with the :raw option.
114
- # Calling it on a value not stored with :raw will initialize that value
115
- # to zero.
116
- def increment(key, amount = 1) # :nodoc:
117
- log("incrementing", key, amount)
118
- @data.incr(escape_key(key), amount)
119
- rescue Dalli::DalliError => e
120
- logger.error("DalliError: #{e.message}") if logger
121
- nil
122
- end
123
-
124
- # Decrement a cached value. This method uses the memcached decr atomic
125
- # operator and can only be used on values written with the :raw option.
126
- # Calling it on a value not stored with :raw will initialize that value
127
- # to zero.
128
- def decrement(key, amount = 1) # :nodoc:
129
- log("decrement", key, amount)
130
- @data.decr(escape_key(key), amount)
131
- rescue Dalli::DalliError => e
132
- logger.error("DalliError: #{e.message}") if logger
133
- nil
134
- end
135
-
136
- def delete_matched(matcher, options = nil) # :nodoc:
137
- # don't do any local caching at present, just pass
138
- # through and let the error happen
139
- super
140
- raise "Not supported by Memcache"
141
- end
142
-
143
- # Clear the entire cache on all memcached servers. This method should
144
- # be used with care when using a shared cache.
145
- def clear
146
- @data.flush_all
147
- end
148
-
149
- # Get the statistics from the memcached servers.
150
- def stats
151
- @data.stats
152
- end
153
-
154
- private
155
-
156
- # Exists in 2.3.8 but not in 2.3.2 so roll our own version
157
- def expires_in(options)
158
- expires_in = (options && options[:expires_in]) || @expires_in
159
-
160
- raise ":expires_in must be a number" if expires_in && !expires_in.is_a?(Numeric)
161
-
162
- expires_in || 0
163
- end
164
-
165
- def escape_key(key)
166
- prefix = @namespace.is_a?(Proc) ? @namespace.call : @namespace
167
- key = "#{prefix}:#{key}" if prefix
168
- key
169
- end
170
- end
171
- end
172
- end