memcached_session_store 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/Manifest +5 -0
- data/README.md +46 -0
- data/Rakefile +12 -0
- data/lib/memcached_session_store.rb +45 -0
- data/memcached_session_store.gemspec +35 -0
- metadata +105 -0
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
Binary file
|
data/Manifest
ADDED
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# MemcachedSessionStore
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
This is a fork of the MemCacheStore, modified to work with Memcached. Reason for this gem is that
|
6
|
+
Heroku (http://www.heroku.com) provides memcached plugins through NorthScale (http://www.northscale.com/) and it requires
|
7
|
+
authentication. MemCacheStore uses memcache-client and it doesnt provide authentication.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
gem install memcached_session_store
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
In config/enviroment.rb:
|
16
|
+
config.gem "memcached"
|
17
|
+
config.gem "memcached_session_store"
|
18
|
+
|
19
|
+
In the session_store initializer:
|
20
|
+
require "memcached_session_store"
|
21
|
+
ActionController::Base.session_store = :memcached_session_store
|
22
|
+
|
23
|
+
## License
|
24
|
+
|
25
|
+
Copyright (c) 2010 Jaakko Suutarla
|
26
|
+
|
27
|
+
Permission is hereby granted, free of charge, to any person
|
28
|
+
obtaining a copy of this software and associated documentation
|
29
|
+
files (the "Software"), to deal in the Software without
|
30
|
+
restriction, including without limitation the rights to use,
|
31
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
32
|
+
copies of the Software, and to permit persons to whom the
|
33
|
+
Software is furnished to do so, subject to the following
|
34
|
+
conditions:
|
35
|
+
|
36
|
+
The above copyright notice and this permission notice shall be
|
37
|
+
included in all copies or substantial portions of the Software.
|
38
|
+
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
40
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
41
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
42
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
43
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
44
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
45
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
46
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('memcached_session_store', '0.0.3') do |p|
|
6
|
+
p.description = "Storing Rails session with memcached while using Heroku memcache plugin."
|
7
|
+
p.url = "http://github.com/jaakkos/memcached_session_store_gem"
|
8
|
+
p.author = "Jaakko Suutarla"
|
9
|
+
p.email = "jaakko@suutarla.com"
|
10
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
+
p.development_dependencies = ["memcached"]
|
12
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'memcached'
|
2
|
+
|
3
|
+
module ActionController
|
4
|
+
module Session
|
5
|
+
class MemcachedSessionStore < AbstractStore
|
6
|
+
def initialize(app, options = {})
|
7
|
+
|
8
|
+
options[:expire_after] ||= options[:expires]
|
9
|
+
super
|
10
|
+
|
11
|
+
@pool = options[:cache] || Memcached::Rails.new()
|
12
|
+
|
13
|
+
begin
|
14
|
+
@pool.stats
|
15
|
+
rescue Memcached::SomeErrorsWereReported
|
16
|
+
raise "#{self} unable to find server during initialization."
|
17
|
+
end
|
18
|
+
|
19
|
+
@mutex = Mutex.new
|
20
|
+
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def get_session(env, sid)
|
26
|
+
sid ||= generate_sid
|
27
|
+
begin
|
28
|
+
session = @pool.get(sid) || {}
|
29
|
+
rescue Errno::ECONNREFUSED
|
30
|
+
session = {}
|
31
|
+
end
|
32
|
+
[sid, session]
|
33
|
+
end
|
34
|
+
|
35
|
+
def set_session(env, sid, session_data)
|
36
|
+
options = env['rack.session.options']
|
37
|
+
expiry = options[:expire_after] || 0
|
38
|
+
@pool.set(sid, session_data, expiry)
|
39
|
+
sid
|
40
|
+
rescue Errno::ECONNREFUSED
|
41
|
+
false
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{memcached_session_store}
|
5
|
+
s.version = "0.0.3"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jaakko Suutarla"]
|
9
|
+
s.cert_chain = ["/Users/japesuut/.gem/own-keys/gem-public_cert.pem"]
|
10
|
+
s.date = %q{2010-05-23}
|
11
|
+
s.description = %q{Storing Rails session with memcached while using Heroku memcache plugin.}
|
12
|
+
s.email = %q{jaakko@suutarla.com}
|
13
|
+
s.extra_rdoc_files = ["README.md", "lib/memcached_session_store.rb"]
|
14
|
+
s.files = ["Manifest", "README.md", "Rakefile", "lib/memcached_session_store.rb", "memcached_session_store.gemspec"]
|
15
|
+
s.homepage = %q{http://github.com/jaakkos/memcached_session_store_gem}
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Memcached_session_store", "--main", "README.md"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{memcached_session_store}
|
19
|
+
s.rubygems_version = %q{1.3.6}
|
20
|
+
s.signing_key = %q{/Users/japesuut/.gem/own-keys/gem-private_key.pem}
|
21
|
+
s.summary = %q{Storing Rails session with memcached while using Heroku memcache plugin.}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 3
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
s.add_development_dependency(%q<memcached>, [">= 0"])
|
29
|
+
else
|
30
|
+
s.add_dependency(%q<memcached>, [">= 0"])
|
31
|
+
end
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<memcached>, [">= 0"])
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: memcached_session_store
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Jaakko Suutarla
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain:
|
16
|
+
- |
|
17
|
+
-----BEGIN CERTIFICATE-----
|
18
|
+
MIIDNDCCAhygAwIBAgIBADANBgkqhkiG9w0BAQUFADBAMQ8wDQYDVQQDDAZqYWFr
|
19
|
+
a28xGDAWBgoJkiaJk/IsZAEZFghzdXV0YXJsYTETMBEGCgmSJomT8ixkARkWA2Nv
|
20
|
+
bTAeFw0xMDA1MjMwNzMwMzdaFw0xMTA1MjMwNzMwMzdaMEAxDzANBgNVBAMMBmph
|
21
|
+
YWtrbzEYMBYGCgmSJomT8ixkARkWCHN1dXRhcmxhMRMwEQYKCZImiZPyLGQBGRYD
|
22
|
+
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqXQwloaTuL0WFFEP
|
23
|
+
IU5PV3mQGRsqUbPuVetCdZdmPYga9B3KzUTN2JtoKuBLGC8gARX2hMOx6XPU8xSC
|
24
|
+
dZuMHjV3MsE6noklCcZ35DRO+uza6oTxeFVVBE9cIbMDeDIg0tsKGKBx7wV0k9ri
|
25
|
+
SF8tRniAjq2r4P3Jl5kpWe0D5+HxfU2dDOKTFUbGKwQa+qsM4jIAHq776iR4KwkQ
|
26
|
+
XY6XA7UOLzg/G3DXVxL95NAvp1A2K7waU6qtVcZaYiEpnt8SbsonU133jcC87BP3
|
27
|
+
TTj3TDZ0Cs0vSTPkMVXbkz6jpygJuhGz14flSS0aLfn4tvnqOmuzWLMvviVF8shm
|
28
|
+
EeEuJwIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
|
29
|
+
n3ur7uzpV8LuFctKsLUMYu5VOxIwDQYJKoZIhvcNAQEFBQADggEBABmcgL7mcaA5
|
30
|
+
PzIgr6eC+funAV6FiKop3V2ZwHsNaB90PZAeqhl9UgJQ7ck/mPeL3q7okEla4I8V
|
31
|
+
DNX4H7ERcYC5opvzjnu2BQdzXbEj9+kBj6PPN1Wq6HKdVENPw/fTzmPW+kMTBsjT
|
32
|
+
iiP2JHGjPxZbfii5KCSqrbI57VPzjlgVcgAxzWzV+uJYjeW6sOsqyO/rI7tvZXVG
|
33
|
+
X0DHFGt6wlATkrjnC41Vk//ekyUtXRNC8oq0/55jycHwU9/jH5d9mHEyRxjBUEiS
|
34
|
+
FKbpzTKT0F6+oI8fep33IyZZTwqrm54Rd0fMqrwN2m00oRFHVBnKMnxP5cdE1AWd
|
35
|
+
72PZ8tsel7k=
|
36
|
+
-----END CERTIFICATE-----
|
37
|
+
|
38
|
+
date: 2010-05-23 00:00:00 +03:00
|
39
|
+
default_executable:
|
40
|
+
dependencies:
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: memcached
|
43
|
+
prerelease: false
|
44
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
segments:
|
49
|
+
- 0
|
50
|
+
version: "0"
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id001
|
53
|
+
description: Storing Rails session with memcached while using Heroku memcache plugin.
|
54
|
+
email: jaakko@suutarla.com
|
55
|
+
executables: []
|
56
|
+
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files:
|
60
|
+
- README.md
|
61
|
+
- lib/memcached_session_store.rb
|
62
|
+
files:
|
63
|
+
- Manifest
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- lib/memcached_session_store.rb
|
67
|
+
- memcached_session_store.gemspec
|
68
|
+
has_rdoc: true
|
69
|
+
homepage: http://github.com/jaakkos/memcached_session_store_gem
|
70
|
+
licenses: []
|
71
|
+
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options:
|
74
|
+
- --line-numbers
|
75
|
+
- --inline-source
|
76
|
+
- --title
|
77
|
+
- Memcached_session_store
|
78
|
+
- --main
|
79
|
+
- README.md
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 1
|
95
|
+
- 2
|
96
|
+
version: "1.2"
|
97
|
+
requirements: []
|
98
|
+
|
99
|
+
rubyforge_project: memcached_session_store
|
100
|
+
rubygems_version: 1.3.6
|
101
|
+
signing_key:
|
102
|
+
specification_version: 3
|
103
|
+
summary: Storing Rails session with memcached while using Heroku memcache plugin.
|
104
|
+
test_files: []
|
105
|
+
|
metadata.gz.sig
ADDED
Binary file
|