Sha256: fa90e792f41050dbd2cd08e21fc5f31b10a9cb9ff2de9dc3e886e4e7b329e853

Contents?: true

Size: 583 Bytes

Versions: 11

Compression:

Stored size: 583 Bytes

Contents

module Capcoauth
  module OAuth
    class TTLCache

      def self.user_id_for(access_token)
        store.fetch(key_for(access_token))
      end

      def self.update(access_token, user_id)
        store.write(key_for(access_token), user_id, expires_in: Capcoauth.configuration.token_verify_ttl)
      end

      def self.remove(access_token)
        store.delete(key_for(access_token))
      end

      def self.key_for(access_token)
        "capcoauth_token:#{access_token}"
      end

      def self.store
        Capcoauth.configuration.cache_store
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
capcoauth-0.7.0 lib/capcoauth/oauth/ttl_cache.rb
capcoauth-0.6.3 lib/capcoauth/oauth/ttl_cache.rb
capcoauth-0.6.2 lib/capcoauth/oauth/ttl_cache.rb
capcoauth-0.6.1 lib/capcoauth/oauth/ttl_cache.rb
capcoauth-0.6.0 lib/capcoauth/oauth/ttl_cache.rb
capcoauth-0.5.1 lib/capcoauth/oauth/ttl_cache.rb
capcoauth-0.5.0 lib/capcoauth/oauth/ttl_cache.rb
capcoauth-0.4.0 lib/capcoauth/oauth/ttl_cache.rb
capcoauth-0.3.3 lib/capcoauth/oauth/ttl_cache.rb
capcoauth-0.3.2 lib/capcoauth/oauth/ttl_cache.rb
capcoauth-0.3.1 lib/capcoauth/oauth/ttl_cache.rb