diff --git a/Gemfile b/Gemfile index 0aac35a4b..97447f78f 100644 --- a/Gemfile +++ b/Gemfile @@ -51,6 +51,7 @@ group :development, :test do gem "activerecord-typedstore" gem "identity_cache" gem "cityhash" # identity_cache emits a warning if this is not present + gem "dalli" # identity_cache emits a warning if this is not present gem "activeresource" gem "google-protobuf" gem "graphql" diff --git a/Gemfile.lock b/Gemfile.lock index 64b3fda2b..1ce91e688 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -137,6 +137,8 @@ GEM bigdecimal rexml crass (1.0.6) + dalli (4.0.0) + logger date (3.5.1) debug (1.11.1) irb (~> 1.10) @@ -436,6 +438,7 @@ DEPENDENCIES bcrypt cityhash config + dalli debug frozen_record google-protobuf diff --git a/sorbet/rbi/gems/dalli@4.0.0.rbi b/sorbet/rbi/gems/dalli@4.0.0.rbi new file mode 100644 index 000000000..8813d0288 --- /dev/null +++ b/sorbet/rbi/gems/dalli@4.0.0.rbi @@ -0,0 +1,2464 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `dalli` gem. +# Please instead update this file by running `bin/tapioca gem dalli`. + + +# Namespace for all Dalli code. +# +# pkg:gem/dalli#lib/dalli.rb:6 +module Dalli + class << self + # pkg:gem/dalli#lib/dalli.rb:46 + def default_logger; end + + # pkg:gem/dalli#lib/dalli.rb:37 + def logger; end + + # pkg:gem/dalli#lib/dalli.rb:53 + def logger=(logger); end + + # pkg:gem/dalli#lib/dalli.rb:41 + def rails_logger; end + end +end + +# Dalli::Client is the main class which developers will use to interact with +# Memcached. +# +# pkg:gem/dalli#lib/dalli/client.rb:12 +class Dalli::Client + # Dalli::Client is the main class which developers will use to interact with + # the memcached server. Usage: + # + # Dalli::Client.new(['localhost:11211:10', + # 'cache-2.example.com:11211:5', + # '192.168.0.1:22122:5', + # '/var/run/memcached/socket'], + # failover: true, expires_in: 300) + # + # servers is an Array of "host:port:weight" where weight allows you to distribute cache unevenly. + # Both weight and port are optional. If you pass in nil, Dalli will use the MEMCACHE_SERVERS + # environment variable or default to 'localhost:11211' if it is not present. Dalli also supports + # the ability to connect to Memcached on localhost through a UNIX socket. To use this functionality, + # use a full pathname (beginning with a slash character '/') in place of the "host:port" pair in + # the server configuration. + # + # Options: + # - :namespace - prepend each key with this value to provide simple namespacing. + # - :failover - if a server is down, look for and store values on another server in the ring. Default: true. + # - :threadsafe - ensure that only one thread is actively using a socket at a time. Default: true. + # - :expires_in - default TTL in seconds if you do not pass TTL as a parameter to an individual operation, defaults + # to 0 or forever. + # - :compress - if true Dalli will compress values larger than compression_min_size bytes before sending them + # to memcached. Default: true. + # - :compression_min_size - the minimum size (in bytes) for which Dalli will compress values sent to Memcached. + # Defaults to 4K. + # - :serializer - defaults to Marshal + # - :compressor - defaults to Dalli::Compressor, a Zlib-based implementation + # - :cache_nils - defaults to false, if true Dalli will not treat cached nil values as 'not found' for + # #fetch operations. + # - :digest_class - defaults to Digest::MD5, allows you to pass in an object that responds to the hexdigest method, + # useful for injecting a FIPS compliant hash object. + # - :protocol - one of either :binary or :meta, defaulting to :binary. This sets the protocol that Dalli uses + # to communicate with memcached. + # + # @return [Client] a new instance of Client + # + # pkg:gem/dalli#lib/dalli/client.rb:49 + def initialize(servers = T.unsafe(nil), options = T.unsafe(nil)); end + + # Conditionally add a key/value pair, if the key does not already exist + # on the server. Returns truthy if the operation succeeded. + # + # pkg:gem/dalli#lib/dalli/client.rb:214 + def add(key, value, ttl = T.unsafe(nil), req_options = T.unsafe(nil)); end + + # Make sure memcache servers are alive, or raise an Dalli::RingError + # + # pkg:gem/dalli#lib/dalli/client.rb:342 + def alive!; end + + # Append value to the value already stored on the server for 'key'. + # Appending only works for values stored with :raw => true. + # + # pkg:gem/dalli#lib/dalli/client.rb:246 + def append(key, value); end + + # pkg:gem/dalli#lib/dalli/client.rb:361 + def cache_nils; end + + # compare and swap values using optimistic locking. + # Fetch the existing value for key. + # If it exists, yield the value to the block. + # Add the block's return value as the new value for the key. + # Add will fail if someone else changed the value. + # + # Returns: + # - nil if the key did not exist. + # - false if the value was changed by someone else. + # - true if the value was successfully updated. + # + # pkg:gem/dalli#lib/dalli/client.rb:158 + def cas(key, ttl = T.unsafe(nil), req_options = T.unsafe(nil), &_arg3); end + + # like #cas, but will yield to the block whether or not the value + # already exists. + # + # Returns: + # - false if the value was changed by someone else. + # - true if the value was successfully updated. + # + # pkg:gem/dalli#lib/dalli/client.rb:169 + def cas!(key, ttl = T.unsafe(nil), req_options = T.unsafe(nil), &_arg3); end + + # Close our connection to each server. + # If you perform another operation after this, the connections will be re-established. + # + # pkg:gem/dalli#lib/dalli/client.rb:349 + def close; end + + # Decr subtracts the given amount from the counter on the memcached server. + # Amt must be a positive integer value. + # + # memcached counters are unsigned and cannot hold negative values. Calling + # decr on a counter which is 0 will just return 0. + # + # If default is nil, the counter must already exist or the operation + # will fail and will return nil. Otherwise this method will return + # the new value for the counter. + # + # Note that the ttl will only apply if the counter does not already + # exist. To decrease an existing counter and update its TTL, use + # #cas. + # + # If the value already exists, it must have been set with raw: true + # + # pkg:gem/dalli#lib/dalli/client.rb:292 + def decr(key, amt = T.unsafe(nil), ttl = T.unsafe(nil), default = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/client.rb:239 + def delete(key); end + + # Delete a key/value pair, verifying existing CAS. + # Returns true if succeeded, and falsy otherwise. + # + # pkg:gem/dalli#lib/dalli/client.rb:235 + def delete_cas(key, cas = T.unsafe(nil)); end + + # Fetch the value associated with the key. + # If a value is found, then it is returned. + # + # If a value is not found and no block is given, then nil is returned. + # + # If a value is not found (or if the found value is nil and :cache_nils is false) + # and a block is given, the block will be invoked and its return value + # written to the cache and returned. + # + # pkg:gem/dalli#lib/dalli/client.rb:137 + def fetch(key, ttl = T.unsafe(nil), req_options = T.unsafe(nil)); end + + # Flush the memcached server, at 'delay' seconds in the future. + # Delay defaults to zero seconds, which means an immediate flush. + # + # pkg:gem/dalli#lib/dalli/client.rb:302 + def flush(delay = T.unsafe(nil)); end + + # Flush the memcached server, at 'delay' seconds in the future. + # Delay defaults to zero seconds, which means an immediate flush. + # + # pkg:gem/dalli#lib/dalli/client.rb:305 + def flush_all(delay = T.unsafe(nil)); end + + # Gat (get and touch) fetch an item and simultaneously update its expiration time. + # + # If a value is not found, then +nil+ is returned. + # + # pkg:gem/dalli#lib/dalli/client.rb:71 + def gat(key, ttl = T.unsafe(nil)); end + + # Get the value associated with the key. + # If a value is not found, then +nil+ is returned. + # + # pkg:gem/dalli#lib/dalli/client.rb:63 + def get(key, req_options = T.unsafe(nil)); end + + # Get the value and CAS ID associated with the key. If a block is provided, + # value and CAS will be passed to the block. + # + # @yield [value, cas] + # + # pkg:gem/dalli#lib/dalli/client.rb:87 + def get_cas(key); end + + # Fetch multiple keys efficiently. + # If a block is given, yields key/value pairs one at a time. + # Otherwise returns a hash of { 'key' => 'value', 'key2' => 'value1' } + # + # pkg:gem/dalli#lib/dalli/client.rb:98 + def get_multi(*keys); end + + # Fetch multiple keys efficiently, including available metadata such as CAS. + # If a block is given, yields key/data pairs one a time. Data is an array: + # [value, cas_id] + # If no block is given, returns a hash of + # { 'key' => [value, cas_id] } + # + # pkg:gem/dalli#lib/dalli/client.rb:119 + def get_multi_cas(*keys); end + + # Incr adds the given amount to the counter on the memcached server. + # Amt must be a positive integer value. + # + # If default is nil, the counter must already exist or the operation + # will fail and will return nil. Otherwise this method will return + # the new value for the counter. + # + # Note that the ttl will only apply if the counter does not already + # exist. To increase an existing counter and update its TTL, use + # #cas. + # + # If the value already exists, it must have been set with raw: true + # + # pkg:gem/dalli#lib/dalli/client.rb:270 + def incr(key, amt = T.unsafe(nil), ttl = T.unsafe(nil), default = T.unsafe(nil)); end + + # Turn on quiet aka noreply support for a number of + # memcached operations. + # + # All relevant operations within this block will be effectively + # pipelined as Dalli will use 'quiet' versions. The invoked methods + # will all return nil, rather than their usual response. Method + # latency will be substantially lower, as the caller will not be + # blocking on responses. + # + # Currently supports storage (set, add, replace, append, prepend), + # arithmetic (incr, decr), flush and delete operations. Use of + # unsupported operations inside a block will raise an error. + # + # Any error replies will be discarded at the end of the block, and + # Dalli client methods invoked inside the block will not + # have return values + # + # pkg:gem/dalli#lib/dalli/client.rb:198 + def multi; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/client.rb:357 + def not_found?(val); end + + # Prepend value to the value already stored on the server for 'key'. + # Prepending only works for values stored with :raw => true. + # + # pkg:gem/dalli#lib/dalli/client.rb:253 + def prepend(key, value); end + + # Turn on quiet aka noreply support for a number of + # memcached operations. + # + # All relevant operations within this block will be effectively + # pipelined as Dalli will use 'quiet' versions. The invoked methods + # will all return nil, rather than their usual response. Method + # latency will be substantially lower, as the caller will not be + # blocking on responses. + # + # Currently supports storage (set, add, replace, append, prepend), + # arithmetic (incr, decr), flush and delete operations. Use of + # unsupported operations inside a block will raise an error. + # + # Any error replies will be discarded at the end of the block, and + # Dalli client methods invoked inside the block will not + # have return values + # + # pkg:gem/dalli#lib/dalli/client.rb:190 + def quiet; end + + # Conditionally add a key/value pair, only if the key already exists + # on the server. Returns truthy if the operation succeeded. + # + # pkg:gem/dalli#lib/dalli/client.rb:221 + def replace(key, value, ttl = T.unsafe(nil), req_options = T.unsafe(nil)); end + + # Conditionally add a key/value pair, verifying existing CAS, only if the + # key already exists on the server. Returns the new CAS value if the + # operation succeeded, or falsy otherwise. + # + # pkg:gem/dalli#lib/dalli/client.rb:229 + def replace_cas(key, value, cas, ttl = T.unsafe(nil), req_options = T.unsafe(nil)); end + + # Close our connection to each server. + # If you perform another operation after this, the connections will be re-established. + # + # pkg:gem/dalli#lib/dalli/client.rb:353 + def reset; end + + # Reset stats for each server. + # + # pkg:gem/dalli#lib/dalli/client.rb:324 + def reset_stats; end + + # pkg:gem/dalli#lib/dalli/client.rb:200 + def set(key, value, ttl = T.unsafe(nil), req_options = T.unsafe(nil)); end + + # Set the key-value pair, verifying existing CAS. + # Returns the resulting CAS value if succeeded, and falsy otherwise. + # + # pkg:gem/dalli#lib/dalli/client.rb:207 + def set_cas(key, value, cas, ttl = T.unsafe(nil), req_options = T.unsafe(nil)); end + + # Collect the stats for each server. + # You can optionally pass a type including :items, :slabs or :settings to get specific stats + # Returns a hash like { 'hostname:port' => { 'stat1' => 'value1', ... }, 'hostname2:port' => { ... } } + # + # pkg:gem/dalli#lib/dalli/client.rb:313 + def stats(type = T.unsafe(nil)); end + + # Touch updates expiration time for a given key. + # + # Returns true if key exists, otherwise nil. + # + # pkg:gem/dalli#lib/dalli/client.rb:79 + def touch(key, ttl = T.unsafe(nil)); end + + # Version of the memcache servers. + # + # pkg:gem/dalli#lib/dalli/client.rb:332 + def version; end + + # Stub method so a bare Dalli client can pretend to be a connection pool. + # + # @yield [_self] + # @yieldparam _self [Dalli::Client] the object that the method was called on + # + # pkg:gem/dalli#lib/dalli/client.rb:366 + def with; end + + private + + # pkg:gem/dalli#lib/dalli/client.rb:376 + def cas_core(key, always_set, ttl = T.unsafe(nil), req_options = T.unsafe(nil)); end + + # @raise [ArgumentError] + # + # pkg:gem/dalli#lib/dalli/client.rb:372 + def check_positive!(amt); end + + # pkg:gem/dalli#lib/dalli/client.rb:433 + def normalize_options(opts); end + + # Chokepoint method for memcached methods with a key argument. + # Validates the key, resolves the key to the appropriate server + # instance, and invokes the memcached method on the appropriate + # server. + # + # This method also forces retries on network errors - when + # a particular memcached instance becomes unreachable, or the + # operational times out. + # + # pkg:gem/dalli#lib/dalli/client.rb:417 + def perform(*all_args); end + + # pkg:gem/dalli#lib/dalli/client.rb:440 + def pipelined_getter; end + + # pkg:gem/dalli#lib/dalli/client.rb:398 + def protocol_implementation; end + + # pkg:gem/dalli#lib/dalli/client.rb:394 + def ring; end + + # Uses the argument TTL or the client-wide default. Ensures + # that the value is an integer + # + # pkg:gem/dalli#lib/dalli/client.rb:388 + def ttl_or_default(ttl); end +end + +# pkg:gem/dalli#lib/dalli/client.rb:307 +Dalli::Client::ALLOWED_STAT_KEYS = T.let(T.unsafe(nil), Array) + +# pkg:gem/dalli#lib/dalli/client.rb:355 +Dalli::Client::CACHE_NILS = T.let(T.unsafe(nil), Hash) + +# Default compressor used by Dalli, that uses +# Zlib DEFLATE to compress data. +# +# pkg:gem/dalli#lib/dalli/compressor.rb:11 +class Dalli::Compressor + class << self + # pkg:gem/dalli#lib/dalli/compressor.rb:12 + def compress(data); end + + # pkg:gem/dalli#lib/dalli/compressor.rb:16 + def decompress(data); end + end +end + +# generic error +# +# pkg:gem/dalli#lib/dalli.rb:8 +class Dalli::DalliError < ::RuntimeError; end + +# Alternate compressor for Dalli, that uses +# Gzip. Gzip adds a checksum to each compressed +# entry. +# +# pkg:gem/dalli#lib/dalli/compressor.rb:26 +class Dalli::GzipCompressor + class << self + # pkg:gem/dalli#lib/dalli/compressor.rb:27 + def compress(data); end + + # pkg:gem/dalli#lib/dalli/compressor.rb:35 + def decompress(data); end + end +end + +# This class manages and validates keys sent to Memcached, ensuring +# that they meet Memcached key length requirements, and supporting +# the implementation of optional namespaces on a per-Dalli client +# basis. +# +# pkg:gem/dalli#lib/dalli/key_manager.rb:12 +class Dalli::KeyManager + # @return [KeyManager] a new instance of KeyManager + # + # pkg:gem/dalli#lib/dalli/key_manager.rb:31 + def initialize(client_options); end + + # pkg:gem/dalli#lib/dalli/key_manager.rb:73 + def digest_class; end + + # pkg:gem/dalli#lib/dalli/key_manager.rb:97 + def evaluate_namespace; end + + # Returns the key with the namespace prefixed, if a namespace is + # defined. Otherwise just returns the key + # + # pkg:gem/dalli#lib/dalli/key_manager.rb:61 + def key_with_namespace(key); end + + # pkg:gem/dalli#lib/dalli/key_manager.rb:67 + def key_without_namespace(key); end + + # Returns the value of attribute namespace. + # + # pkg:gem/dalli#lib/dalli/key_manager.rb:29 + def namespace; end + + # pkg:gem/dalli#lib/dalli/key_manager.rb:89 + def namespace_from_options; end + + # pkg:gem/dalli#lib/dalli/key_manager.rb:77 + def namespace_regexp; end + + # pkg:gem/dalli#lib/dalli/key_manager.rb:113 + def prefix_length(digest); end + + # Produces a truncated key, if the raw key is longer than the maximum allowed + # length. The truncated key is produced by generating a hex digest + # of the key, and appending that to a truncated section of the key. + # + # pkg:gem/dalli#lib/dalli/key_manager.rb:108 + def truncated_key(key); end + + # @raise [ArgumentError] + # + # pkg:gem/dalli#lib/dalli/key_manager.rb:83 + def validate_digest_class_option(opts); end + + # Validates the key, and transforms as needed. + # + # If the key is nil or empty, raises ArgumentError. Whitespace + # characters are allowed for historical reasons, but likely shouldn't + # be used. + # If the key (with namespace) is shorter than the memcached maximum + # allowed key length, just returns the argument key + # Otherwise computes a "truncated" key that uses a truncated prefix + # combined with a 32-byte hex digest of the whole key. + # + # @raise [ArgumentError] + # + # pkg:gem/dalli#lib/dalli/key_manager.rb:50 + def validate_key(key); end +end + +# pkg:gem/dalli#lib/dalli/key_manager.rb:23 +Dalli::KeyManager::DEFAULTS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/dalli#lib/dalli/key_manager.rb:13 +Dalli::KeyManager::MAX_KEY_LENGTH = T.let(T.unsafe(nil), Integer) + +# pkg:gem/dalli#lib/dalli/key_manager.rb:15 +Dalli::KeyManager::NAMESPACE_SEPARATOR = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/key_manager.rb:27 +Dalli::KeyManager::OPTIONS = T.let(T.unsafe(nil), Array) + +# This is a hard coded md5 for historical reasons +# +# pkg:gem/dalli#lib/dalli/key_manager.rb:18 +Dalli::KeyManager::TRUNCATED_KEY_SEPARATOR = T.let(T.unsafe(nil), String) + +# This is 249 for historical reasons +# +# pkg:gem/dalli#lib/dalli/key_manager.rb:21 +Dalli::KeyManager::TRUNCATED_KEY_TARGET_SIZE = T.let(T.unsafe(nil), Integer) + +# pkg:gem/dalli#lib/dalli/version.rb:6 +Dalli::MIN_SUPPORTED_MEMCACHED_VERSION = T.let(T.unsafe(nil), String) + +# application error in marshalling serialization +# +# pkg:gem/dalli#lib/dalli.rb:17 +class Dalli::MarshalError < ::Dalli::DalliError; end + +# pkg:gem/dalli#lib/dalli.rb:33 +Dalli::NOT_FOUND = T.let(T.unsafe(nil), Dalli::NilObject) + +# socket/server communication error +# +# pkg:gem/dalli#lib/dalli.rb:11 +class Dalli::NetworkError < ::Dalli::DalliError; end + +# Implements the NullObject pattern to store an application-defined value for 'Key not found' responses. +# +# pkg:gem/dalli#lib/dalli.rb:32 +class Dalli::NilObject; end + +# operation is not permitted in a multi block +# +# pkg:gem/dalli#lib/dalli.rb:26 +class Dalli::NotPermittedMultiOpError < ::Dalli::DalliError; end + +# Dalli::PIDCache is a wrapper class for PID checking to avoid system calls when checking the PID. +# +# pkg:gem/dalli#lib/dalli/pid_cache.rb:7 +module Dalli::PIDCache + class << self + # Returns the value of attribute pid. + # + # pkg:gem/dalli#lib/dalli/pid_cache.rb:13 + def pid; end + + # pkg:gem/dalli#lib/dalli/pid_cache.rb:15 + def update!; end + end +end + +# Dalli::PIDCache::CoreExt hooks into Process to be able to reset the PID cache after fork +# +# pkg:gem/dalli#lib/dalli/pid_cache.rb:24 +module Dalli::PIDCache::CoreExt + # pkg:gem/dalli#lib/dalli/pid_cache.rb:25 + def _fork; end +end + +# Contains logic for the pipelined gets implemented by the client. +# +# pkg:gem/dalli#lib/dalli/pipelined_getter.rb:7 +class Dalli::PipelinedGetter + # @return [PipelinedGetter] a new instance of PipelinedGetter + # + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:8 + def initialize(ring, key_manager); end + + # Swallows Dalli::NetworkError + # + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:128 + def abort_with_timeout(servers); end + + # Swallows Dalli::NetworkError + # + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:91 + def abort_without_timeout(servers); end + + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:95 + def fetch_responses(servers, start_time, timeout, &block); end + + # This loops through the servers that have keys in + # our set, sending the noop to terminate the set of queries. + # + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:59 + def finish_queries(servers); end + + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:80 + def finish_query_for_server(server); end + + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:164 + def groups_for_keys(*keys); end + + # Loop through the server-grouped sets of keys, writing + # the corresponding getkq requests to the appropriate servers + # + # It's worth noting that we could potentially reduce bytes + # on the wire by switching from getkq to getq, and using + # the opaque value to match requests to responses. + # + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:46 + def make_getkq_requests(groups); end + + # Yields, one at a time, keys and their values+attributes. + # + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:16 + def process(keys, &block); end + + # Processes responses from a server. Returns true if there are no + # additional responses from this server. + # + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:139 + def process_server(server); end + + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:120 + def remaining_time(start, timeout); end + + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:147 + def servers_with_response(servers, timeout); end + + # pkg:gem/dalli#lib/dalli/pipelined_getter.rb:30 + def setup_requests(keys); end +end + +# pkg:gem/dalli#lib/dalli/protocol.rb:6 +module Dalli::Protocol; end + +# Base class for a single Memcached server, containing logic common to all +# protocols. Contains logic for managing connection state to the server and value +# handling. +# +# pkg:gem/dalli#lib/dalli/protocol/base.rb:14 +class Dalli::Protocol::Base + extend ::Forwardable + + # @return [Base] a new instance of Base + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:23 + def initialize(attribs, client_options = T.unsafe(nil)); end + + # Boolean method used by clients of this class to determine if this + # particular memcached instance is available for use. + # + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:57 + def alive?; end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def close(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:19 + def compress_by_default?(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:19 + def compression_min_size(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:19 + def compressor(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def connected?(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def down!(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def hostname(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:65 + def lock!; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:150 + def multi?; end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def name(*_arg0, **_arg1, &_arg2); end + + # Returns the value of attribute options. + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:17 + def options; end + + # Sets the attribute options + # + # @param value the value to set the attribute options to. + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:17 + def options=(_arg0); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:139 + def password; end + + # Abort current pipelined get. Generally used to signal an external + # timeout during pipelined get. The underlying socket is + # disconnected, and the exception is swallowed. + # + # Returns nothing. + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:118 + def pipeline_abort; end + + # Did the last call to #pipeline_response_setup complete successfully? + # + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:131 + def pipeline_complete?; end + + # Attempt to receive and parse as many key/value pairs as possible + # from this server. After #pipeline_response_setup, this should be invoked + # repeatedly whenever this server's socket is readable until + # #pipeline_complete?. + # + # Returns a Hash of kv pairs received. + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:86 + def pipeline_next_responses; end + + # Start reading key/value pairs from this connection. This is usually called + # after a series of GETKQ commands. A NOOP is sent, and the server begins + # flushing responses for kv pairs that were found. + # + # Returns nothing. + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:74 + def pipeline_response_setup; end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def port(*_arg0, **_arg1, &_arg2); end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:147 + def quiet?; end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def raise_down_error(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def reconnect_down_server?(*_arg0, **_arg1, &_arg2); end + + # Chokepoint method for error handling and ensuring liveness + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:31 + def request(opkey, *args); end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:143 + def require_auth?; end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:19 + def serializer(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def sock(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def socket_timeout(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def socket_type(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:67 + def unlock!; end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def up!(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:135 + def username; end + + # Returns the value of attribute weight. + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:17 + def weight; end + + # Sets the attribute weight + # + # @param value the value to set the attribute weight to. + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:17 + def weight=(_arg0); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:20 + def write(*_arg0, **_arg1, &_arg2); end + + private + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:202 + def cache_nils?(opts); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:208 + def connect; end + + # The socket connection to the underlying server is initialized as a side + # effect of this call. In fact, this is the ONLY place where that + # socket connection is initialized. + # + # Both this method and connect need to be in this class so we can do auth + # as required + # + # Since this is invoked exclusively in verify_state!, we don't need to worry about + # thread safety. Using it elsewhere may require revisiting that assumption. + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:194 + def ensure_connected!; end + + # Called after the noop response is received at the end of a set + # of pipelined gets + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:230 + def finish_pipeline; end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:241 + def log_marshal_err(key, err); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:246 + def log_unexpected_err(err); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:215 + def pipelined_get(keys); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:237 + def reconnect_on_pipeline_complete!; end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:224 + def response_buffer; end + + # @raise [Dalli::NotPermittedMultiOpError] + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:159 + def verify_allowed_quiet!(opkey); end + + # pkg:gem/dalli#lib/dalli/protocol/base.rb:180 + def verify_pipelined_state(_opkey); end + + # Checks to see if we can execute the specified operation. Checks + # whether the connection is in use, and whether the command is allowed + # + # pkg:gem/dalli#lib/dalli/protocol/base.rb:169 + def verify_state(opkey); end +end + +# pkg:gem/dalli#lib/dalli/protocol/base.rb:156 +Dalli::Protocol::Base::ALLOWED_QUIET_OPS = T.let(T.unsafe(nil), Array) + +# Access point for a single Memcached server, accessed via Memcached's binary +# protocol. Contains logic for managing connection state to the server (retries, etc), +# formatting requests to the server, and unpacking responses. +# +# pkg:gem/dalli#lib/dalli/protocol/binary.rb:14 +class Dalli::Protocol::Binary < ::Dalli::Protocol::Base + include ::Dalli::Protocol::Binary::SaslAuthentication + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:15 + def response_processor; end + + private + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:59 + def add(key, value, ttl, options); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:82 + def append(key, value); end + + # TODO: This is confusing, as there's a cas command in memcached + # and this isn't it. Maybe rename? Maybe eliminate? + # + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:47 + def cas(key); end + + # Arithmetic Commands + # + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:106 + def decr(key, count, ttl, initial); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:124 + def decr_incr(opkey, key, count, ttl, initial); end + + # Delete Commands + # + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:98 + def delete(key, cas); end + + # Other Commands + # + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:133 + def flush(ttl = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:32 + def gat(key, ttl, options = T.unsafe(nil)); end + + # Retrieval Commands + # + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:22 + def get(key, options = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:111 + def incr(key, count, ttl, initial); end + + # Noop is a keepalive operation but also used to demarcate the end of a set of pipelined commands. + # We need to read all the responses at once. + # + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:141 + def noop; end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:87 + def prepend(key, value); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:28 + def quiet_get_request(key); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:64 + def replace(key, value, ttl, cas, options); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:152 + def reset_stats; end + + # Storage Commands + # + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:54 + def set(key, value, ttl, cas, options); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:146 + def stats(info = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:70 + def storage_req(opkey, key, value, ttl, cas, options); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:39 + def touch(key, ttl); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:157 + def version; end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:92 + def write_append_prepend(opkey, key, value); end + + # pkg:gem/dalli#lib/dalli/protocol/binary.rb:162 + def write_noop; end +end + +# This allows us to special case a nil initial value, and +# handle it differently than a zero. This special value +# for expiry causes memcached to return a not found +# if the key doesn't already exist, rather than +# setting the initial value +# +# pkg:gem/dalli#lib/dalli/protocol/binary.rb:121 +Dalli::Protocol::Binary::NOT_FOUND_EXPIRY = T.let(T.unsafe(nil), Integer) + +# Class that encapsulates logic for formatting binary protocol requests +# to memcached. +# +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:10 +class Dalli::Protocol::Binary::RequestFormatter + class << self + # pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:111 + def as_8byte_uint(val); end + + # pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:102 + def decr_incr_request(opkey:, key: T.unsafe(nil), count: T.unsafe(nil), initial: T.unsafe(nil), expiry: T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:92 + def standard_request(opkey:, key: T.unsafe(nil), value: T.unsafe(nil), opaque: T.unsafe(nil), cas: T.unsafe(nil), bitflags: T.unsafe(nil), ttl: T.unsafe(nil)); end + end +end + +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:53 +Dalli::Protocol::Binary::RequestFormatter::BODY_FORMATS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:89 +Dalli::Protocol::Binary::RequestFormatter::FORMAT = T.let(T.unsafe(nil), Hash) + +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:49 +Dalli::Protocol::Binary::RequestFormatter::INCR_DECR = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:48 +Dalli::Protocol::Binary::RequestFormatter::KEY_AND_VALUE = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:46 +Dalli::Protocol::Binary::RequestFormatter::KEY_ONLY = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:51 +Dalli::Protocol::Binary::RequestFormatter::NO_BODY = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:13 +Dalli::Protocol::Binary::RequestFormatter::OPCODES = T.let(T.unsafe(nil), Hash) + +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:11 +Dalli::Protocol::Binary::RequestFormatter::REQUEST = T.let(T.unsafe(nil), Integer) + +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:44 +Dalli::Protocol::Binary::RequestFormatter::REQ_HEADER_FORMAT = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:47 +Dalli::Protocol::Binary::RequestFormatter::TTL_AND_KEY = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/binary/request_formatter.rb:50 +Dalli::Protocol::Binary::RequestFormatter::TTL_ONLY = T.let(T.unsafe(nil), String) + +# Class that encapsulates data parsed from a memcached response header. +# +# pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:9 +class Dalli::Protocol::Binary::ResponseHeader + # @raise [ArgumentError] + # @return [ResponseHeader] a new instance of ResponseHeader + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:15 + def initialize(buf); end + + # Returns the value of attribute body_len. + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:13 + def body_len; end + + # Returns the value of attribute cas. + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:13 + def cas; end + + # Returns the value of attribute data_type. + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:13 + def data_type; end + + # Returns the value of attribute extra_len. + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:13 + def extra_len; end + + # Returns the value of attribute key_len. + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:13 + def key_len; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:25 + def not_found?; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:30 + def not_stored?; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:21 + def ok?; end + + # Returns the value of attribute opaque. + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:13 + def opaque; end + + # Returns the value of attribute status. + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:13 + def status; end +end + +# pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:11 +Dalli::Protocol::Binary::ResponseHeader::FMT = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:29 +Dalli::Protocol::Binary::ResponseHeader::NOT_STORED_STATUSES = T.let(T.unsafe(nil), Array) + +# pkg:gem/dalli#lib/dalli/protocol/binary/response_header.rb:10 +Dalli::Protocol::Binary::ResponseHeader::SIZE = T.let(T.unsafe(nil), Integer) + +# Class that encapsulates logic for processing binary protocol responses +# from memcached. Includes logic for pulling data from an IO source +# and parsing into local values. Handles errors on unexpected values. +# +# pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:11 +class Dalli::Protocol::Binary::ResponseProcessor + # @return [ResponseProcessor] a new instance of ResponseProcessor + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:34 + def initialize(io_source, value_marshaller); end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:184 + def auth_response(buf = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:150 + def consume_all_responses_until_noop; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:192 + def contains_header?(buf); end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:103 + def data_cas_response; end + + # Returns the new value for the key, if found and updated + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:115 + def decr_incr; end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:95 + def delete; end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:138 + def flush; end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:158 + def generic_response; end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:69 + def get(cache_nils: T.unsafe(nil)); end + + # This method returns an array of values used in a pipelined + # getk process. The first value is the number of bytes by + # which to advance the pointer in the buffer. If the + # complete response is found in the buffer, this will + # be the response size. Otherwise it is zero. + # + # The remaining three values in the array are the ResponseHeader, + # key, and value. + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:212 + def getk_response_from_buffer(buf); end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:170 + def no_body_response; end + + # @raise [Dalli::DalliError] + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:63 + def raise_on_not_ok!(resp_header); end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:39 + def read(num_bytes); end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:59 + def read_header; end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:43 + def read_response; end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:142 + def reset; end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:198 + def response_header_from_buffer(buf); end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:120 + def stats; end + + # Response for a storage operation. Returns the cas on success. False + # if the value wasn't stored. And raises an error on all other error + # codes from memcached. + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:86 + def storage_response; end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:49 + def unpack_response_body(resp_header, body, parse_as_stored_value); end + + # @raise [Dalli::NetworkError] + # + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:178 + def validate_auth_format(extra_len, count); end + + # pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:146 + def version; end +end + +# Response codes taken from: +# https://github.com/memcached/memcached/wiki/BinaryProtocolRevamped#response-status +# +# pkg:gem/dalli#lib/dalli/protocol/binary/response_processor.rb:14 +Dalli::Protocol::Binary::ResponseProcessor::RESPONSE_CODES = T.let(T.unsafe(nil), Hash) + +# Code to support SASL authentication +# +# pkg:gem/dalli#lib/dalli/protocol/binary/sasl_authentication.rb:9 +module Dalli::Protocol::Binary::SaslAuthentication + # @raise [Dalli::DalliError] + # + # pkg:gem/dalli#lib/dalli/protocol/binary/sasl_authentication.rb:40 + def authenticate_connection; end + + # pkg:gem/dalli#lib/dalli/protocol/binary/sasl_authentication.rb:33 + def authenticate_with_plain; end + + # pkg:gem/dalli#lib/dalli/protocol/binary/sasl_authentication.rb:10 + def perform_auth_negotiation; end + + # pkg:gem/dalli#lib/dalli/protocol/binary/sasl_authentication.rb:25 + def supported_mechanisms!(mechanisms); end +end + +# pkg:gem/dalli#lib/dalli/protocol/binary/sasl_authentication.rb:23 +Dalli::Protocol::Binary::SaslAuthentication::PLAIN_AUTH = T.let(T.unsafe(nil), String) + +# Manages the socket connection to the server, including ensuring liveness +# and retries. +# +# pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:15 +class Dalli::Protocol::ConnectionManager + # @return [ConnectionManager] a new instance of ConnectionManager + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:32 + def initialize(hostname, port, socket_type, client_options); end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:145 + def abort_request!; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:112 + def close; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:106 + def confirm_in_progress!; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:101 + def confirm_ready!; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:125 + def connected?; end + + # Marks the server instance as down. Updates the down_at state + # and raises an Dalli::NetworkError that includes the underlying + # error in the message. Calls close to clean up socket state + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:84 + def down!; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:179 + def error_on_request!(err_or_string); end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:52 + def establish_connection; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:139 + def finish_request!; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:229 + def fork_detected?; end + + # Returns the value of attribute hostname. + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:29 + def hostname; end + + # Sets the attribute hostname + # + # @param value the value to set the attribute hostname to. + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:29 + def hostname=(_arg0); end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:233 + def log_down_detected; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:245 + def log_up_detected; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:214 + def log_warn_message(err_or_string); end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:175 + def max_allowed_failures; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:206 + def memcached_socket; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:44 + def name; end + + # Returns the value of attribute options. + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:29 + def options; end + + # Sets the attribute options + # + # @param value the value to set the attribute options to. + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:29 + def options=(_arg0); end + + # Returns the value of attribute port. + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:29 + def port; end + + # Sets the attribute port + # + # @param value the value to set the attribute port to. + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:29 + def port=(_arg0); end + + # @raise [Dalli::NetworkError] + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:93 + def raise_down_error; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:157 + def read(count); end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:149 + def read_line; end + + # Non-blocking read. Here to support the operation + # of the get_multi operation + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:171 + def read_nonblock; end + + # @raise [Dalli::NetworkError] + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:192 + def reconnect!(message); end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:63 + def reconnect_down_server?; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:221 + def reconnect_on_fork; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:129 + def request_in_progress?; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:198 + def reset_down_info; end + + # Returns the value of attribute sock. + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:30 + def sock; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:97 + def socket_timeout; end + + # Returns the value of attribute socket_type. + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:29 + def socket_type; end + + # Sets the attribute socket_type + # + # @param value the value to set the attribute socket_type to. + # + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:29 + def socket_type=(_arg0); end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:133 + def start_request!; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:76 + def up!; end + + # pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:163 + def write(bytes); end +end + +# pkg:gem/dalli#lib/dalli/protocol/connection_manager.rb:16 +Dalli::Protocol::ConnectionManager::DEFAULTS = T.let(T.unsafe(nil), Hash) + +# Access point for a single Memcached server, accessed via Memcached's meta +# protocol. Contains logic for managing connection state to the server (retries, etc), +# formatting requests to the server, and unpacking responses. +# +# pkg:gem/dalli#lib/dalli/protocol/meta.rb:14 +class Dalli::Protocol::Meta < ::Dalli::Protocol::Base + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:17 + def response_processor; end + + private + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:69 + def add(key, value, ttl, options); end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:93 + def append(key, value); end + + # @raise [Dalli::DalliError] + # + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:173 + def authenticate_connection; end + + # TODO: This is confusing, as there's a cas command in memcached + # and this isn't it. Maybe rename? Maybe eliminate? + # + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:56 + def cas(key); end + + # Arithmetic Commands + # + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:125 + def decr(key, count, ttl, initial); end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:133 + def decr_incr(incr, key, delta, ttl, initial); end + + # Delete Commands + # + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:116 + def delete(key, cas); end + + # Other Commands + # + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:142 + def flush(delay = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:38 + def gat(key, ttl, options = T.unsafe(nil)); end + + # Retrieval Commands + # + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:26 + def get(key, options = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:129 + def incr(key, count, ttl, initial); end + + # Noop is a keepalive operation but also used to demarcate the end of a set of pipelined commands. + # We need to read all the responses at once. + # + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:149 + def noop; end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:98 + def prepend(key, value); end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:33 + def quiet_get_request(key); end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:74 + def replace(key, value, ttl, cas, options); end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:159 + def reset_stats; end + + # Storage Commands + # + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:64 + def set(key, value, ttl, cas, options); end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:154 + def stats(info = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:46 + def touch(key, ttl); end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:164 + def version; end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:104 + def write_append_prepend_req(mode, key, value, ttl = T.unsafe(nil), cas = T.unsafe(nil), _options = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:169 + def write_noop; end + + # pkg:gem/dalli#lib/dalli/protocol/meta.rb:80 + def write_storage_req(mode, key, raw_value, ttl = T.unsafe(nil), cas = T.unsafe(nil), options = T.unsafe(nil)); end +end + +# The meta protocol requires that keys be ASCII only, so Unicode keys are +# not supported. In addition, the use of whitespace in the key is not +# allowed. +# memcached supports the use of base64 hashes for keys containing +# whitespace or non-ASCII characters, provided the 'b' flag is included in the request. +# +# pkg:gem/dalli#lib/dalli/protocol/meta/key_regularizer.rb:12 +class Dalli::Protocol::Meta::KeyRegularizer + class << self + # pkg:gem/dalli#lib/dalli/protocol/meta/key_regularizer.rb:22 + def decode(encoded_key, base64_encoded); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/key_regularizer.rb:15 + def encode(key); end + end +end + +# pkg:gem/dalli#lib/dalli/protocol/meta/key_regularizer.rb:13 +Dalli::Protocol::Meta::KeyRegularizer::WHITESPACE = T.let(T.unsafe(nil), Regexp) + +# Class that encapsulates logic for formatting meta protocol requests +# to memcached. +# +# pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:10 +class Dalli::Protocol::Meta::RequestFormatter + class << self + # pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:105 + def cas_string(cas); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:73 + def flush(delay: T.unsafe(nil), quiet: T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:49 + def meta_arithmetic(key:, delta:, initial:, incr: T.unsafe(nil), cas: T.unsafe(nil), ttl: T.unsafe(nil), base64: T.unsafe(nil), quiet: T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:40 + def meta_delete(key:, cas: T.unsafe(nil), ttl: T.unsafe(nil), base64: T.unsafe(nil), quiet: T.unsafe(nil)); end + + # Since these are string construction methods, we're going to disable these + # Rubocop directives. We really can't make this construction much simpler, + # and introducing an intermediate object seems like overkill. + # + # + # pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:18 + def meta_get(key:, value: T.unsafe(nil), return_cas: T.unsafe(nil), ttl: T.unsafe(nil), base64: T.unsafe(nil), quiet: T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:65 + def meta_noop; end + + # pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:28 + def meta_set(key:, value:, bitflags: T.unsafe(nil), cas: T.unsafe(nil), ttl: T.unsafe(nil), mode: T.unsafe(nil), base64: T.unsafe(nil), quiet: T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:90 + def mode_to_token(mode); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:110 + def parse_to_64_bit_int(val, default); end + + # @raise [ArgumentError] + # + # pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:82 + def stats(arg = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:69 + def version; end + end +end + +# pkg:gem/dalli#lib/dalli/protocol/meta/request_formatter.rb:80 +Dalli::Protocol::Meta::RequestFormatter::ALLOWED_STATS_ARGS = T.let(T.unsafe(nil), Array) + +# Class that encapsulates logic for processing meta protocol responses +# from memcached. Includes logic for pulling data from an IO source +# and parsing into local values. Handles errors on unexpected values. +# +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:11 +class Dalli::Protocol::Meta::ResponseProcessor + # @return [ResponseProcessor] a new instance of ResponseProcessor + # + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:26 + def initialize(io_source, value_marshaller); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:179 + def bitflags_from_tokens(tokens); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:193 + def body_len_from_tokens(tokens); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:183 + def cas_from_tokens(tokens); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:108 + def consume_all_responses_until_mn; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:161 + def contains_header?(buf); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:73 + def decr_incr; end + + # @raise [Dalli::ServerError] + # + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:169 + def error_on_unexpected!(expected_codes); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:91 + def flush; end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:123 + def full_response_from_buffer(tokens, body, resp_size); end + + # This method returns an array of values used in a pipelined + # getk process. The first value is the number of bytes by + # which to advance the pointer in the buffer. If the + # complete response is found in the buffer, this will + # be the response size. Otherwise it is zero. + # + # The remaining three values in the array are the ResponseHeader, + # key, and value. + # + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:138 + def getk_response_from_buffer(buf); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:165 + def header_from_buffer(buf); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:187 + def key_from_tokens(tokens); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:68 + def meta_delete; end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:31 + def meta_get_with_value(cache_nils: T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:39 + def meta_get_with_value_and_cas; end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:49 + def meta_get_without_value; end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:61 + def meta_set_append_prepend; end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:54 + def meta_set_with_cas; end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:208 + def next_line_to_tokens; end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:213 + def read_data(data_size); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:204 + def read_line; end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:97 + def reset; end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:81 + def stats; end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:115 + def tokens_from_header_buffer(buf); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:197 + def value_from_tokens(tokens, flag); end + + # pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:103 + def version; end +end + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:12 +Dalli::Protocol::Meta::ResponseProcessor::EN = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:13 +Dalli::Protocol::Meta::ResponseProcessor::END_TOKEN = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:14 +Dalli::Protocol::Meta::ResponseProcessor::EX = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:15 +Dalli::Protocol::Meta::ResponseProcessor::HD = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:16 +Dalli::Protocol::Meta::ResponseProcessor::MN = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:17 +Dalli::Protocol::Meta::ResponseProcessor::NF = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:18 +Dalli::Protocol::Meta::ResponseProcessor::NS = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:19 +Dalli::Protocol::Meta::ResponseProcessor::OK = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:20 +Dalli::Protocol::Meta::ResponseProcessor::RESET = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:24 +Dalli::Protocol::Meta::ResponseProcessor::SERVER_ERROR = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:21 +Dalli::Protocol::Meta::ResponseProcessor::STAT = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:22 +Dalli::Protocol::Meta::ResponseProcessor::VA = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta/response_processor.rb:23 +Dalli::Protocol::Meta::ResponseProcessor::VERSION = T.let(T.unsafe(nil), String) + +# pkg:gem/dalli#lib/dalli/protocol/meta.rb:15 +Dalli::Protocol::Meta::TERMINATOR = T.let(T.unsafe(nil), String) + +# Preserved for backwards compatibility. Should be removed in 4.0 +# +# pkg:gem/dalli#lib/dalli/protocol.rb:8 +Dalli::Protocol::NOT_FOUND = T.let(T.unsafe(nil), Dalli::NilObject) + +# Manages the buffer for responses from memcached. +# +# pkg:gem/dalli#lib/dalli/protocol/response_buffer.rb:11 +class Dalli::Protocol::ResponseBuffer + # @return [ResponseBuffer] a new instance of ResponseBuffer + # + # pkg:gem/dalli#lib/dalli/protocol/response_buffer.rb:12 + def initialize(io_source, response_processor); end + + # Advances the internal response buffer by bytes_to_advance + # bytes. The + # + # pkg:gem/dalli#lib/dalli/protocol/response_buffer.rb:32 + def advance(bytes_to_advance); end + + # Clear the internal response buffer + # + # pkg:gem/dalli#lib/dalli/protocol/response_buffer.rb:45 + def clear; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/response_buffer.rb:49 + def in_progress?; end + + # Attempts to process a single response from the buffer. Starts + # by advancing the buffer to the specified start position + # + # pkg:gem/dalli#lib/dalli/protocol/response_buffer.rb:24 + def process_single_getk_response; end + + # pkg:gem/dalli#lib/dalli/protocol/response_buffer.rb:18 + def read; end + + # Resets the internal buffer to an empty state, + # so that we're ready to read pipelined responses + # + # pkg:gem/dalli#lib/dalli/protocol/response_buffer.rb:40 + def reset; end +end + +# Dalli::Protocol::ServerConfigParser parses a server string passed to +# a Dalli::Protocol::Binary instance into the hostname, port, weight, and +# socket_type. +# +# pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:12 +class Dalli::Protocol::ServerConfigParser + class << self + # pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:67 + def attributes_for_tcp_socket(res); end + + # @raise [Dalli::DalliError] + # + # pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:60 + def attributes_for_unix_socket(res); end + + # @raise [Dalli::DalliError] + # + # pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:53 + def deconstruct_string(str); end + + # @raise [Dalli::DalliError] + # + # pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:71 + def normalize_host_from_match(str, res); end + + # pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:77 + def normalize_port(port); end + + # pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:81 + def normalize_weight(weight); end + + # pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:24 + def parse(str); end + + # pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:39 + def parse_non_uri(str); end + + # pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:30 + def parse_uri(str); end + end +end + +# pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:21 +Dalli::Protocol::ServerConfigParser::DEFAULT_PORT = T.let(T.unsafe(nil), Integer) + +# pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:22 +Dalli::Protocol::ServerConfigParser::DEFAULT_WEIGHT = T.let(T.unsafe(nil), Integer) + +# pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:13 +Dalli::Protocol::ServerConfigParser::MEMCACHED_URI_PROTOCOL = T.let(T.unsafe(nil), String) + +# TODO: Revisit this, especially the IP/domain part. Likely +# can limit character set to LDH + '.'. Hex digit section +# is there to support IPv6 addresses, which need to be specified with +# a bounding [] +# +# pkg:gem/dalli#lib/dalli/protocol/server_config_parser.rb:19 +Dalli::Protocol::ServerConfigParser::SERVER_CONFIG_REGEXP = T.let(T.unsafe(nil), Regexp) + +# Ruby 3.2 raises IO::TimeoutError on blocking reads/writes, but +# it is not defined in earlier Ruby versions. +# +# pkg:gem/dalli#lib/dalli/protocol.rb:12 +Dalli::Protocol::TIMEOUT_ERRORS = T.let(T.unsafe(nil), Array) + +# Utility class for sanitizing TTL arguments based on Memcached rules. +# TTLs are either expirations times in seconds (with a maximum value of +# 30 days) or expiration timestamps. This class sanitizes TTLs to ensure +# they meet those restrictions. +# +# pkg:gem/dalli#lib/dalli/protocol/ttl_sanitizer.rb:11 +class Dalli::Protocol::TtlSanitizer + class << self + # pkg:gem/dalli#lib/dalli/protocol/ttl_sanitizer.rb:29 + def as_timestamp(ttl_as_i); end + + # Pulled out into a method so it's easy to stub time + # + # pkg:gem/dalli#lib/dalli/protocol/ttl_sanitizer.rb:40 + def current_timestamp; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/ttl_sanitizer.rb:25 + def less_than_max_expiration_interval?(ttl_as_i); end + + # Ensures the TTL passed to Memcached is a valid TTL in the expected format. + # + # pkg:gem/dalli#lib/dalli/protocol/ttl_sanitizer.rb:18 + def sanitize(ttl); end + end +end + +# https://github.com/memcached/memcached/blob/master/doc/protocol.txt#L79 +# > An expiration time, in seconds. Can be up to 30 days. After 30 days, is +# treated as a unix timestamp of an exact date. +# +# pkg:gem/dalli#lib/dalli/protocol/ttl_sanitizer.rb:15 +Dalli::Protocol::TtlSanitizer::MAX_ACCEPTABLE_EXPIRATION_INTERVAL = T.let(T.unsafe(nil), Integer) + +# Dalli::Protocol::ValueCompressor compartmentalizes the logic for managing +# compression and decompression of stored values. It manages interpreting +# relevant options from both client and request, determining whether to +# compress/decompress on store/retrieve, and processes bitflags as necessary. +# +# pkg:gem/dalli#lib/dalli/protocol/value_compressor.rb:13 +class Dalli::Protocol::ValueCompressor + # @return [ValueCompressor] a new instance of ValueCompressor + # + # pkg:gem/dalli#lib/dalli/protocol/value_compressor.rb:27 + def initialize(client_options); end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/value_compressor.rb:51 + def compress_by_default?; end + + # Checks whether we should apply compression when serializing a value + # based on the specified options. Returns false unless the value + # is greater than the minimum compression size. Otherwise returns + # based on a method-level option if specified, falling back to the + # server default. + # + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/protocol/value_compressor.rb:68 + def compress_value?(value, req_options); end + + # pkg:gem/dalli#lib/dalli/protocol/value_compressor.rb:59 + def compression_min_size; end + + # pkg:gem/dalli#lib/dalli/protocol/value_compressor.rb:55 + def compressor; end + + # pkg:gem/dalli#lib/dalli/protocol/value_compressor.rb:40 + def retrieve(value, bitflags); end + + # pkg:gem/dalli#lib/dalli/protocol/value_compressor.rb:32 + def store(value, req_options, bitflags); end +end + +# pkg:gem/dalli#lib/dalli/protocol/value_compressor.rb:14 +Dalli::Protocol::ValueCompressor::DEFAULTS = T.let(T.unsafe(nil), Hash) + +# https://www.hjp.at/zettel/m/memcached_flags.rxml +# Looks like most clients use bit 1 to indicate gzip compression. +# +# pkg:gem/dalli#lib/dalli/protocol/value_compressor.rb:25 +Dalli::Protocol::ValueCompressor::FLAG_COMPRESSED = T.let(T.unsafe(nil), Integer) + +# pkg:gem/dalli#lib/dalli/protocol/value_compressor.rb:21 +Dalli::Protocol::ValueCompressor::OPTIONS = T.let(T.unsafe(nil), Array) + +# Dalli::Protocol::ValueMarshaller compartmentalizes the logic for marshalling +# and unmarshalling unstructured data (values) to Memcached. It also enforces +# limits on the maximum size of marshalled data. +# +# pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:12 +class Dalli::Protocol::ValueMarshaller + extend ::Forwardable + + # @return [ValueMarshaller] a new instance of ValueMarshaller + # + # pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:25 + def initialize(client_options); end + + # pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:23 + def compress_by_default?(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:23 + def compression_min_size(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:23 + def compressor(*_arg0, **_arg1, &_arg2); end + + # @raise [Dalli::ValueOverMaxSize] + # + # pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:51 + def error_if_over_max_value_bytes(key, value); end + + # pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:42 + def retrieve(value, flags); end + + # pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:22 + def serializer(*_arg0, **_arg1, &_arg2); end + + # pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:33 + def store(key, value, options = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:47 + def value_max_bytes; end +end + +# pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:15 +Dalli::Protocol::ValueMarshaller::DEFAULTS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/dalli#lib/dalli/protocol/value_marshaller.rb:20 +Dalli::Protocol::ValueMarshaller::OPTIONS = T.let(T.unsafe(nil), Array) + +# Dalli::Protocol::ValueSerializer compartmentalizes the logic for managing +# serialization and deserialization of stored values. It manages interpreting +# relevant options from both client and request, determining whether to +# serialize/deserialize on store/retrieve, and processes bitflags as necessary. +# +# pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:11 +class Dalli::Protocol::ValueSerializer + # @return [ValueSerializer] a new instance of ValueSerializer + # + # pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:28 + def initialize(protocol_options); end + + # pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:55 + def retrieve(value, bitflags); end + + # pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:26 + def serialization_options; end + + # pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:26 + def serialization_options=(_arg0); end + + # pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:74 + def serialize_value(value); end + + # pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:70 + def serializer; end + + # pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:34 + def store(value, req_options, bitflags); end + + private + + # pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:88 + def warn_if_marshal_default(protocol_options); end +end + +# pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:12 +Dalli::Protocol::ValueSerializer::DEFAULTS = T.let(T.unsafe(nil), Hash) + +# https://www.hjp.at/zettel/m/memcached_flags.rxml +# Looks like most clients use bit 0 to indicate native language serialization +# +# pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:20 +Dalli::Protocol::ValueSerializer::FLAG_SERIALIZED = T.let(T.unsafe(nil), Integer) + +# pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:21 +Dalli::Protocol::ValueSerializer::FLAG_UTF8 = T.let(T.unsafe(nil), Integer) + +# pkg:gem/dalli#lib/dalli/protocol/value_serializer.rb:16 +Dalli::Protocol::ValueSerializer::OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/dalli#lib/dalli.rb:35 +Dalli::QUIET = T.let(T.unsafe(nil), Symbol) + +# An implementation of a consistent hash ring, designed to minimize +# the cache miss impact of adding or removing servers from the ring. +# That is, adding or removing a server from the ring should impact +# the key -> server mapping of ~ 1/N of the stored keys where N is the +# number of servers in the ring. This is done by creating a large +# number of "points" per server, distributed over the space +# 0x00000000 - 0xFFFFFFFF. For a given key, we calculate the CRC32 +# hash, and find the nearest "point" that is less than or equal to the +# the key's hash. In this implemetation, each "point" is represented +# by a Dalli::Ring::Entry. +# +# pkg:gem/dalli#lib/dalli/ring.rb:19 +class Dalli::Ring + # @return [Ring] a new instance of Ring + # + # pkg:gem/dalli#lib/dalli/ring.rb:26 + def initialize(servers_arg, protocol_implementation, options); end + + # pkg:gem/dalli#lib/dalli/ring.rb:97 + def close; end + + # this is the default in libmemcached + # + # pkg:gem/dalli#lib/dalli/ring.rb:24 + def continuum; end + + # this is the default in libmemcached + # + # pkg:gem/dalli#lib/dalli/ring.rb:24 + def continuum=(_arg0); end + + # pkg:gem/dalli#lib/dalli/ring.rb:66 + def keys_grouped_by_server(key_arr); end + + # pkg:gem/dalli#lib/dalli/ring.rb:75 + def lock; end + + # pkg:gem/dalli#lib/dalli/ring.rb:84 + def pipeline_consume_and_ignore_responses; end + + # @raise [Dalli::RingError] + # + # pkg:gem/dalli#lib/dalli/ring.rb:37 + def server_for_key(key); end + + # pkg:gem/dalli#lib/dalli/ring.rb:51 + def server_from_continuum(key); end + + # this is the default in libmemcached + # + # pkg:gem/dalli#lib/dalli/ring.rb:24 + def servers; end + + # this is the default in libmemcached + # + # pkg:gem/dalli#lib/dalli/ring.rb:24 + def servers=(_arg0); end + + # pkg:gem/dalli#lib/dalli/ring.rb:93 + def socket_timeout; end + + private + + # pkg:gem/dalli#lib/dalli/ring.rb:128 + def build_continuum(servers); end + + # pkg:gem/dalli#lib/dalli/ring.rb:113 + def entry_count_for(server, total_servers, total_weight); end + + # pkg:gem/dalli#lib/dalli/ring.rb:109 + def hash_for(key); end + + # pkg:gem/dalli#lib/dalli/ring.rb:117 + def server_for_hash_key(hash_key); end + + # pkg:gem/dalli#lib/dalli/ring.rb:103 + def threadsafe!; end +end + +# Represents a point in the consistent hash ring implementation. +# +# pkg:gem/dalli#lib/dalli/ring.rb:144 +class Dalli::Ring::Entry + # @return [Entry] a new instance of Entry + # + # pkg:gem/dalli#lib/dalli/ring.rb:147 + def initialize(val, srv); end + + # Returns the value of attribute server. + # + # pkg:gem/dalli#lib/dalli/ring.rb:145 + def server; end + + # Returns the value of attribute value. + # + # pkg:gem/dalli#lib/dalli/ring.rb:145 + def value; end +end + +# The number of entries on the continuum created per server +# in an equally weighted scenario. +# +# pkg:gem/dalli#lib/dalli/ring.rb:22 +Dalli::Ring::POINTS_PER_SERVER = T.let(T.unsafe(nil), Integer) + +# no server available/alive error +# +# pkg:gem/dalli#lib/dalli.rb:14 +class Dalli::RingError < ::Dalli::DalliError; end + +# raised when Memcached response with a SERVER_ERROR +# +# pkg:gem/dalli#lib/dalli.rb:29 +class Dalli::ServerError < ::Dalli::DalliError; end + +# This module contains methods for validating and normalizing the servers +# argument passed to the client. This argument can be nil, a string, or +# an array of strings. Each string value in the argument can represent +# a single server or a comma separated list of servers. +# +# If nil, it falls back to the values of ENV['MEMCACHE_SERVERS'] if the latter is +# defined. If that environment value is not defined, a default of '127.0.0.1:11211' +# is used. +# +# A server config string can take one of three forms: +# * A colon separated string of (host, port, weight) where both port and +# weight are optional (e.g. 'localhost', 'abc.com:12345', 'example.org:22222:3') +# * A colon separated string of (UNIX socket, weight) where the weight is optional +# (e.g. '/var/run/memcached/socket', '/tmp/xyz:3') (not supported on Windows) +# * A URI with a 'memcached' protocol, which will typically include a username/password +# +# The methods in this module do not validate the format of individual server strings, but +# rather normalize the argument into a compact array, wherein each array entry corresponds +# to a single server config string. If that normalization is not possible, then an +# ArgumentError is thrown. +# +# pkg:gem/dalli#lib/dalli/servers_arg_normalizer.rb:26 +module Dalli::ServersArgNormalizer + class << self + # pkg:gem/dalli#lib/dalli/servers_arg_normalizer.rb:40 + def apply_defaults(arg); end + + # Normalizes the argument into an array of servers. + # If the argument is a string, or an array containing strings, it's expected that the URIs are comma separated e.g. + # "memcache1.example.com:11211,memcache2.example.com:11211,memcache3.example.com:11211" + # + # pkg:gem/dalli#lib/dalli/servers_arg_normalizer.rb:34 + def normalize_servers(arg); end + + # @raise [ArgumentError] + # + # pkg:gem/dalli#lib/dalli/servers_arg_normalizer.rb:46 + def validate_type(arg); end + end +end + +# pkg:gem/dalli#lib/dalli/servers_arg_normalizer.rb:28 +Dalli::ServersArgNormalizer::DEFAULT_SERVERS = T.let(T.unsafe(nil), Array) + +# pkg:gem/dalli#lib/dalli/servers_arg_normalizer.rb:27 +Dalli::ServersArgNormalizer::ENV_VAR_NAME = T.let(T.unsafe(nil), String) + +# Various socket implementations used by Dalli. +# +# pkg:gem/dalli#lib/dalli/socket.rb:10 +module Dalli::Socket; end + +# Common methods for all socket implementations. +# +# pkg:gem/dalli#lib/dalli/socket.rb:14 +module Dalli::Socket::InstanceMethods + # @raise [Timeout::Error] + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/socket.rb:39 + def append_to_buffer?(result); end + + # pkg:gem/dalli#lib/dalli/socket.rb:54 + def logged_options; end + + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/socket.rb:46 + def nonblock_timed_out?(result); end + + # pkg:gem/dalli#lib/dalli/socket.rb:25 + def read_available; end + + # pkg:gem/dalli#lib/dalli/socket.rb:15 + def readfull(count); end +end + +# pkg:gem/dalli#lib/dalli/socket.rb:53 +Dalli::Socket::InstanceMethods::FILTERED_OUT_OPTIONS = T.let(T.unsafe(nil), Array) + +# pkg:gem/dalli#lib/dalli/socket.rb:37 +Dalli::Socket::InstanceMethods::WAIT_RCS = T.let(T.unsafe(nil), Array) + +# Wraps the below TCP socket class in the case where the client +# has configured a TLS/SSL connection between Dalli and the +# Memcached server. +# +# pkg:gem/dalli#lib/dalli/socket.rb:64 +class Dalli::Socket::SSLSocket < ::OpenSSL::SSL::SSLSocket + include ::Dalli::Socket::InstanceMethods + + # pkg:gem/dalli#lib/dalli/socket.rb:67 + def options; end +end + +# A standard TCP socket between the Dalli client and the Memcached server. +# +# pkg:gem/dalli#lib/dalli/socket.rb:87 +class Dalli::Socket::TCP < ::TCPSocket + include ::Dalli::Socket::InstanceMethods + + # options - supports enhanced logging in the case of a timeout + # + # pkg:gem/dalli#lib/dalli/socket.rb:91 + def options; end + + # options - supports enhanced logging in the case of a timeout + # + # pkg:gem/dalli#lib/dalli/socket.rb:91 + def options=(_arg0); end + + class << self + # pkg:gem/dalli#lib/dalli/socket.rb:132 + def configure_socket_buffers(sock, options); end + + # pkg:gem/dalli#lib/dalli/socket.rb:127 + def configure_tcp_options(sock, options); end + + # pkg:gem/dalli#lib/dalli/socket.rb:137 + def configure_timeout(sock, options); end + + # pkg:gem/dalli#lib/dalli/socket.rb:102 + def create_socket_with_timeout(host, port, options); end + + # pkg:gem/dalli#lib/dalli/socket.rb:121 + def init_socket_options(sock, options); end + + # pkg:gem/dalli#lib/dalli/socket.rb:93 + def open(host, port, options = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/dalli/socket.rb:151 + def wrapping_ssl_socket(tcp_socket, host, ssl_context); end + end +end + +# UNIX represents a UNIX domain socket, which is an interprocess communication +# mechanism between processes on the same host. Used when the Memcached server +# is running on the same machine as the Dalli client. +# +# pkg:gem/dalli#lib/dalli/socket.rb:176 +class Dalli::Socket::UNIX < ::UNIXSocket + include ::Dalli::Socket::InstanceMethods + + # options - supports enhanced logging in the case of a timeout + # server - used to support IO.select in the pipelined getter + # + # pkg:gem/dalli#lib/dalli/socket.rb:181 + def options; end + + # options - supports enhanced logging in the case of a timeout + # server - used to support IO.select in the pipelined getter + # + # pkg:gem/dalli#lib/dalli/socket.rb:181 + def options=(_arg0); end + + class << self + # pkg:gem/dalli#lib/dalli/socket.rb:192 + def init_socket_options(sock, options); end + + # pkg:gem/dalli#lib/dalli/socket.rb:183 + def open(path, options = T.unsafe(nil)); end + end +end + +# Make Dalli threadsafe by using a lock around all +# public server methods. +# +# Dalli::Protocol::Binary.extend(Dalli::Threadsafe) +# +# pkg:gem/dalli#lib/dalli/options.rb:11 +module Dalli::Threadsafe + # @return [Boolean] + # + # pkg:gem/dalli#lib/dalli/options.rb:22 + def alive?; end + + # pkg:gem/dalli#lib/dalli/options.rb:28 + def close; end + + # pkg:gem/dalli#lib/dalli/options.rb:60 + def init_threadsafe; end + + # pkg:gem/dalli#lib/dalli/options.rb:52 + def lock!; end + + # pkg:gem/dalli#lib/dalli/options.rb:46 + def pipeline_abort; end + + # pkg:gem/dalli#lib/dalli/options.rb:40 + def pipeline_next_responses; end + + # pkg:gem/dalli#lib/dalli/options.rb:34 + def pipeline_response_setup; end + + # pkg:gem/dalli#lib/dalli/options.rb:16 + def request(opcode, *args); end + + # pkg:gem/dalli#lib/dalli/options.rb:56 + def unlock!; end + + class << self + # @private + # + # pkg:gem/dalli#lib/dalli/options.rb:12 + def extended(obj); end + end +end + +# application error in marshalling deserialization or decompression +# +# pkg:gem/dalli#lib/dalli.rb:20 +class Dalli::UnmarshalError < ::Dalli::DalliError; end + +# pkg:gem/dalli#lib/dalli/version.rb:4 +Dalli::VERSION = T.let(T.unsafe(nil), String) + +# payload too big for memcached +# +# pkg:gem/dalli#lib/dalli.rb:23 +class Dalli::ValueOverMaxSize < ::Dalli::DalliError; end + +module Process + extend ::SQLite3::ForkSafety::CoreExt + extend ::Dalli::PIDCache::CoreExt + extend ::ConnectionPool::ForkTracker + extend ::RedisClient::PIDCache::CoreExt + extend ::ActiveSupport::ForkTracker::CoreExt +end + +# pkg:gem/dalli#lib/rack/session/dalli.rb:8 +module Rack; end + +# pkg:gem/dalli#lib/rack/session/dalli.rb:9 +module Rack::Session; end + +# Rack::Session::Dalli provides memcached based session management. +# +# pkg:gem/dalli#lib/rack/session/dalli.rb:11 +class Rack::Session::Dalli < ::Rack::Session::Abstract::PersistedSecure + # Brings in a new Rack::Session::Dalli middleware with the given + # `:memcache_server`. The server is either a hostname, or a + # host-with-port string in the form of "host_name:port", or an array of + # such strings. For example: + # + # use Rack::Session::Dalli, + # :memcache_server => "mc.example.com:1234" + # + # If no `:memcache_server` option is specified, Rack::Session::Dalli will + # connect to localhost, port 11211 (the default memcached port). If + # `:memcache_server` is set to nil, Dalli::Client will look for + # ENV['MEMCACHE_SERVERS'] and use that value if it is available, or fall + # back to the same default behavior described above. + # + # Rack::Session::Dalli accepts the same options as Dalli::Client, so + # it's worth reviewing its documentation. Perhaps most importantly, + # if you don't specify a `:namespace` option, Rack::Session::Dalli + # will default to using 'rack:session'. + # + # It is not recommended to set `:expires_in`. Instead, use `:expire_after`, + # which will control both the expiration of the client cookie as well + # as the expiration of the corresponding entry in memcached. + # + # Rack::Session::Dalli also accepts a host of options that control how + # the sessions and session cookies are managed, including the + # aforementioned `:expire_after` option. Please see the documentation for + # Rack::Session::Abstract::Persisted for a detailed explanation of these + # options and their default values. + # + # Finally, if your web application is multithreaded, the + # Rack::Session::Dalli middleware can become a source of contention. You + # can use a connection pool of Dalli clients by passing in the + # `:pool_size` and/or `:pool_timeout` options. For example: + # + # use Rack::Session::Dalli, + # :memcache_server => "mc.example.com:1234", + # :pool_size => 10 + # + # You must include the `connection_pool` gem in your project if you wish + # to use pool support. Please see the documentation for ConnectionPool + # for more information about it and its default options (which would only + # be applicable if you supplied one of the two options, but not both). + # + # @return [Dalli] a new instance of Dalli + # + # pkg:gem/dalli#lib/rack/session/dalli.rb:68 + def initialize(app, options = T.unsafe(nil)); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:77 + def call(*_args); end + + # Returns the value of attribute data. + # + # pkg:gem/dalli#lib/rack/session/dalli.rb:16 + def data; end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:112 + def delete_session(_req, sid, options); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:83 + def find_session(req, sid); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:96 + def write_session(req, sid, session, options); end + + private + + # pkg:gem/dalli#lib/rack/session/dalli.rb:153 + def build_data_source(options); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:135 + def create_sid_with_empty_session(client); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:197 + def ensure_connection_pool_added!; end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:126 + def existing_session_for_sid(client, sid); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:175 + def extract_dalli_options(options); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:144 + def generate_sid_with(client); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:122 + def memcached_key_from_sid(sid); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:184 + def retrieve_client_options(options); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:190 + def retrieve_pool_options(options); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:221 + def session_persisted_data(req); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:217 + def ttl(expire_after); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:225 + def update_session_persisted_data(req, data); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:205 + def with_dalli_client(result_on_error = T.unsafe(nil), &_arg1); end + + # pkg:gem/dalli#lib/rack/session/dalli.rb:166 + def write_session_safely!(dalli_client, sid, persisted_data, write_args:); end +end + +# Don't freeze this until we fix the specs/implementation +# +# pkg:gem/dalli#lib/rack/session/dalli.rb:20 +Rack::Session::Dalli::DEFAULT_DALLI_OPTIONS = T.let(T.unsafe(nil), Hash) + +# pkg:gem/dalli#lib/rack/session/dalli.rb:12 +class Rack::Session::Dalli::MissingSessionError < ::StandardError; end + +# pkg:gem/dalli#lib/rack/session/dalli.rb:14 +Rack::Session::Dalli::RACK_SESSION_PERSISTED = T.let(T.unsafe(nil), String)