Sha256: bc038a4bd1bb26a21a9edd4d451376339cf26d06187a9535c6d10257d2123b6c
Contents?: true
Size: 710 Bytes
Versions: 2
Compression:
Stored size: 710 Bytes
Contents
# frozen_string_literal: true # A simple cache for storing Textcaptcha answers, Rails.cache is used as the # backend (ActiveSupport::Cache) module ActsAsTextcaptcha class TextcaptchaCache KEY_PREFIX = 'acts_as_textcaptcha-' DEFAULT_EXPIRY_MINUTES = 10 def write(key, value, options = {}) unless options.has_key?(:expires_in) options[:expires_in] = DEFAULT_EXPIRY_MINUTES.minutes end Rails.cache.write(cache_key(key), value, options) end def read(key) Rails.cache.read(cache_key(key)) end def delete(key) Rails.cache.delete(cache_key(key)) end private def cache_key(key) "#{KEY_PREFIX}#{key}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
acts_as_textcaptcha-4.5.1 | lib/acts_as_textcaptcha/textcaptcha_cache.rb |
acts_as_textcaptcha-4.5.0 | lib/acts_as_textcaptcha/textcaptcha_cache.rb |