# Sex expire time for Sessions in memcached

**URL:** <https://www.ruby-forum.com/t/sex-expire-time-for-sessions-in-memcached/143129>\
**Category:** Rails\
**Created:** [July 15, 2008, 3:21pm UTC](https://www.ruby-forum.com/t/sex-expire-time-for-sessions-in-memcached/143129 "2008-07-15T15:21:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stanislav](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e5b9ba/32.png) [@stanislav](https://www.ruby-forum.com/u/stanislav)\
**Post date:** [July 15, 2008, 3:21pm UTC](https://www.ruby-forum.com/t/sex-expire-time-for-sessions-in-memcached/143129/1 "2008-07-15T15:21:25Z")

</div>

Hi all,

I have a problem with expiring sessions in the case with using  
mem\_cache\_store. I’ve been using ActiveRecord session store till now and  
expired them with SQL query. Yesterday I switched to memcache for  
storing sessions, however I can’t set an expireation period.

# My current config is this:

memcache\_options = {  
:c\_threshold =\> 10\_000,  
:compression =\> false,  
:debug =\> false,  
:namespace =\> ‘fanopic\_dev’,  
:readonly =\> false,  
:urlencode =\> false  
}  
memcache\_servers = [‘192.168.4.1:11211’]  
config.cache\_store = :mem\_cache\_store, memcache\_servers,  
memcache\_options  
config.action\_controller.session\_store = :mem\_cache\_store

# CACHE = MemCache.new(memcache\_options) CACHE.servers = memcache\_servers ActionController::CgiRequest::DEFAULT\_SESSION\_OPTIONS.merge!({ ‘cache’ =\> CACHE })

Does anyone has an idea how I can specify a expire period for the  
sessions?  
10x in advance.

---

<div class="post-metadata">

**Author:** ![stanislav](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e5b9ba/32.png) [@stanislav](https://www.ruby-forum.com/u/stanislav)\
**Post date:** [July 15, 2008, 3:23pm UTC](https://www.ruby-forum.com/t/sex-expire-time-for-sessions-in-memcached/143129/2 "2008-07-15T15:23:40Z")

</div>

ups,

I’m sorry about the title. It’s TIPO.
