from__future__importannotationsfromcollections.abcimportSequencefromdataclassesimportdataclassfrompathlibimportPathfromtypingimportAnyStr,Generic,NamedTuple,TypeGuard,cast#: Acceptable types for a memcached keyKeyT=str|bytes#: Acceptable types for values to storeValueT=str|bytes|int
[docs]classTCPEndpoint(NamedTuple):""" Location of a memcached server listening on a tcp port """#: IPV4/6 host addresshost:str#: IPV4/6 portport:int
#: Path to a memcached server listening on a UDS socketUnixSocketEndpoint=str|Path
[docs]classAWSAutoDiscoveryEndpoint(NamedTuple):""" Location of a memcached auto-discovery endpoint for use with AWS Elasticache """#: IPV4/6 host addresshost:str#: IPV4/6 portport:int#: How often to trigger a refresh to check for updatesrefresh_interval:float
#: The total description of a single memcached instanceSingleMemcachedInstanceEndpoint=UnixSocketEndpoint|TCPEndpoint|tuple[str,int]#: The total description of either a single memcached instance or a memcached clusterMemcachedEndpoint=(SingleMemcachedInstanceEndpoint|Sequence[SingleMemcachedInstanceEndpoint]|AWSAutoDiscoveryEndpoint)
[docs]@dataclassclassMemcachedItem(Generic[AnyStr]):""" Data class returned by retrieval commands such as :meth:`~memcachio.Client.get`, :meth:`~memcachio.Client.gets`, :meth:`~memcachio.Client.gat` and :meth:`~memcachio.Client.gats` """#: The key of the itemkey:AnyStr#: Any flags set on the itemflags:int#: The size (in bytes) of the data stored in the itemsize:int#: The CAS value for the item if retrievedcas:int|None#: The data value of the itemvalue:AnyStr