Sha256: b0824f7a0c0620a409b490dad7cfa051c7d4a31a3ecc0b2708e58e8035ff5d51
Contents?: true
Size: 560 Bytes
Versions: 2
Compression:
Stored size: 560 Bytes
Contents
# frozen_string_literal: true require 'github/authentication/token' module Github module Authentication class Cache # storage = ActiveSupport::Cache def initialize(storage:, key: '') @storage = storage @key = "github:authentication:#{key}" end def read json = @storage.read(@key) Token.from_json(json) end def write(token) @storage.write(@key, token.to_json, expires_in: token.expires_in) end def clear @storage.delete(@key) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
github-authentication-0.1.2 | lib/github/authentication/cache.rb |
github-authentication-0.1.0 | lib/github/authentication/cache.rb |