mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-06 00:02:08 -04:00
64 lines
1.5 KiB
Plaintext
64 lines
1.5 KiB
Plaintext
module HTTPX
|
|
module Plugins
|
|
module ResponseCache
|
|
CACHEABLE_VERBS: Array[verb]
|
|
CACHEABLE_STATUS_CODES: Array[Integer]
|
|
|
|
def self?.cacheable_request?: (Request & RequestMethods request) -> bool
|
|
def self?.cacheable_response?: (::HTTPX::ErrorResponse | (Response & ResponseMethods) response) -> bool
|
|
def self?.cached_response?: (response response) -> bool
|
|
|
|
class Store
|
|
@store: Hash[String, Array[Response]]
|
|
|
|
@store_mutex: Thread::Mutex
|
|
|
|
def lookup: (Request request) -> Response?
|
|
|
|
def cached?: (Request request) -> boolish
|
|
|
|
def cache: (Request request, Response response) -> void
|
|
|
|
def prepare: (Request request) -> void
|
|
|
|
private
|
|
|
|
def match_by_vary?: (Request request, Response response) -> bool
|
|
|
|
def _get: (Request request) -> Array[Response]?
|
|
|
|
def _set: (Request request, Response response) -> void
|
|
end
|
|
|
|
module InstanceMethods
|
|
@response_cache: Store
|
|
|
|
def clear_response_cache: () -> void
|
|
end
|
|
|
|
module RequestMethods
|
|
@response_cache_key: String
|
|
|
|
def response_cache_key: () -> String
|
|
end
|
|
|
|
module ResponseMethods
|
|
def copy_from_cached: (Response other) -> void
|
|
|
|
def fresh?: () -> bool
|
|
|
|
def cache_control: () -> Array[String]?
|
|
|
|
def vary: () -> Array[String]?
|
|
|
|
private
|
|
|
|
def age: () -> Integer
|
|
|
|
def date: () -> Time
|
|
end
|
|
end
|
|
|
|
type sessionResponseCache = Session & ResponseCache::InstanceMethods
|
|
end
|
|
end |