/usr/lib/ruby/vendor_ruby/merb-core/dispatch/session/memcached.rb is in ruby-merb-core 1.1.3+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | module Merb
# Sessions stored in memcached.
#
# Requires setup in your +init.rb+.
#
# This for the 'memcache-client' gem:
#
# Merb::BootLoader.after_app_loads do
# require 'memcache'
# Merb::MemcacheSession.store =
# MemCache.new('127.0.0.1:11211', :namespace => 'my_app')
# end
#
# Or this for the 'memcached' gem:
#
# Merb::BootLoader.after_app_loads do
# require 'memcache'
# Merb::MemcacheSession.store =
# Memcached.new('127.0.0.1:11211', :namespace => 'my_app')
# end
class MemcacheSession < SessionStoreContainer
# The session store type
self.session_store_type = :memcache
end
module MemcacheStore
# Make the Memcached gem conform to the SessionStoreContainer interface
# ==== Parameters
# session_id<String>:: ID of the session to retrieve.
#
# ==== Returns
# ContainerSession:: The session corresponding to the ID.
#
# :api: private
def retrieve_session(session_id)
get("session:#{session_id}")
end
# ==== Parameters
# session_id<String>:: ID of the session to set.
# data<ContainerSession>:: The session to set.
#
# :api: private
def store_session(session_id, data)
set("session:#{session_id}", data)
end
# ==== Parameters
# session_id<String>:: ID of the session to delete.
#
# :api: private
def delete_session(session_id)
delete("session:#{session_id}")
end
end
end
# For the memcached gem.
class Memcached
include Merb::MemcacheStore
end
# For the memcache-client gem.
class MemCache
include Merb::MemcacheStore
end
|