views:

582

answers:

5

I need a place to keep last request time for user and don't want to use database for that

+1  A: 

You can use memcache for this.

edbond
+1  A: 

if you want to do this user-wise, and don't mind losing it between sessions, then the place to store it is a session like session[:last_request]

Maximiliano Guzman
A: 

Thanks... I got it ... there is no easy solution .. I will use database :)

cobranet
This is not an answer.
Time Machine
+1  A: 

There is an easy solution - you can put it as a constant in config/environment.rb

Ghoti
I need variable not constant
cobranet
Doesn't have to be a constant, you can declare anything there. You may have an issue with multiple copies of the app giving slightly different results.
Ghoti
A: 

there is an easy way (although not so elegant)

if Thread.main[:uuid] == nil 
  Thread.main[:uuid]=0
end
uid = Thread.main[:uuid] += 1

http://giladmanor.com

Gilad Manor