Created
August 19, 2009 15:46
-
-
Save codeprimate/170417 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The CACHE_PATH Proc constant can be used by controller action caching | |
# Example Usage: caches_action :index, :layout => false, :cache_path => CACHE_PATH | |
# Override the CACHE_EXPIRATION constant within your controller to change the | |
# expiration time. | |
#CACHE_EXPIRATION = 5 #in minutes | |
CACHE_PATH = Proc.new{ |controller| | |
"#{Digest::MD5.hexdigest(controller.request.request_uri + | |
controller.request.format + | |
controller.session[:user_id].to_s) + | |
((Time.now - Date.today.to_time).to_i/60).to_f.divmod((CACHE_EXPIRATION || 5))[0].to_s}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment