+
     hM%  c                   s   ^ RI HtHt ^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
HtHtHt  ! R R]4      t ! R R	]4      t]! R
R7       ! R R4      4       t ! R R4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R  R!]4      tR"# )#i    )ABCabstractmethodOrderedDict)	dataclass)Enum)AnyListOptionalUnionc                   s    ] tR t^tRtRtRtR# )CacheEntryStatusVALIDIN_PROGRESS N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__r       0/usr/lib/python3.14/site-packages/redis/cache.pyr
   r
      s    EKr   r
   c                   s    ] tR t^tRtRtRtR# )EvictionPolicyType
time_basedfrequency_basedr   N)r   r   r   r   r   r   r   r   r   r   r   r      s    J'Or   r   T)Zfrozenc                   s,   a  ] tR t^t o V 3R ltRtV tR# )CacheKeyc                s2   < V ^8  d   Qh/ S[ ;R&   S[;R&   # )   command
redis_keys)strZtupleZformat__classdict__   "r   __annotate__ZCacheKey.__annotate__   s     L   r   r   N)r   r   r   r   Z__annotate_func__r   __classdictcell__r      @r   r   r      s      r   r   c                   s>   a  ] tR t^t o V 3R lR ltR tR tRtV tR# )
CacheEntryc                ,   < V ^8  d   QhRS[ RS[RS[/# )r   	cache_keycache_valuestatus)r   bytesr
   r   r   r   r    ZCacheEntry.__annotate__   s)     
- 
-
- 
- !	
-r   c                s6    Wn         W n        W0n        W@n        R # N)r&   r'   r(   connection_ref)selfr&   r'   r(   r+   s   &&&&&r   __init__ZCacheEntry.__init__   s     #&,r   c                sp    \        V P                  V P                  V P                  V P                  34      # r*   )hashr&   r'   r(   r+   r,      &r   __hash__ZCacheEntry.__hash__%   s/    ^^T--t{{D<O<OP
 	
r   c                s0    \        V 4      \        V4      8H  # r*   )r.   )r,   Zother   &&r   __eq__ZCacheEntry.__eq__*   s    DzT%[((r   )r&   r'   r+   r(   N)	r   r   r   r   r-   r1   r3   r   r!   r"   r#   r   r$   r$      s     
- 
-

) )r   r$   c                   s   a  ] tR t^.t o ]]R 4       4       t]P                  R 4       t]]V 3R lR l4       4       t]V 3R lR l4       t	]V 3R lR l4       t
]V 3R	 lR
 l4       tRtV tR# )EvictionPolicyInterfacec                    R # r*   r   r/   r0   r   cacheEvictionPolicyInterface.cache/        	r   c                r5   r*   r   )r,   valuer2   r   r6   r7   4       r   c                    < V ^8  d   QhRS[ /# r   returnr   r   r   r   r    $EvictionPolicyInterface.__annotate__:   s      ( r   c                r5   r*   r   r/   r0   r   typeZEvictionPolicyInterface.type8   r8   r   c                r;   r<   r   r   r   r   r    r?   >   s      H r   c                r5   r*   r   r/   r0   r   
evict_nextZ"EvictionPolicyInterface.evict_next=   r:   r   c                6   < V ^8  d   QhRS[ RS[S[,          /# r   countr=   intr   r   r   r   r   r    r?   B   s       X r   c                r5   r*   r   r,   rE   r2   r   
evict_manyZ"EvictionPolicyInterface.evict_manyA   r:   r   c                $   < V ^8  d   QhRS[ RR/# r   r&   r=   NrA   r   r   r   r    r?   F   s      x D r   c                r5   r*   r   r,   r&   r2   r   touchZEvictionPolicyInterface.touchE   r:   r   r   N)r   r   r   r   propertyr   r6   setterr@   rB   rI   rM   r   r!   r"   r#   r   r4   r4   .   s        \\          r   r4   c                   s   a  ] tR t^Jt o ]R 4       t]V 3R lR l4       t]R 4       t]V 3R lR l4       t]V 3R lR l4       t	R	t
V tR
# )CacheConfigurationInterfacec                r5   r*   r   r/   r0   r   get_cache_classZ+CacheConfigurationInterface.get_cache_classK   r:   r   c                r;   r<   rG   r   r   r   r    (CacheConfigurationInterface.__annotate__P   s      c r   c                r5   r*   r   r/   r0   r   get_max_sizeZ(CacheConfigurationInterface.get_max_sizeO   r:   r   c                r5   r*   r   r/   r0   r   get_eviction_policyZ/CacheConfigurationInterface.get_eviction_policyS   r:   r   c                &   < V ^8  d   QhRS[ RS[/# rD   rG   boolr   r   r   r    rS   X   s        r   c                r5   r*   r   rH   r2   r   is_exceeds_max_sizeZ/CacheConfigurationInterface.is_exceeds_max_sizeW   r:   r   c                rV   r   r   r=   r   rX   r   r   r   r    rS   \   s      3 4 r   c                r5   r*   r   r,   r   r2   r   is_allowed_to_cacheZ/CacheConfigurationInterface.is_allowed_to_cache[   r:   r   r   N)r   r   r   r   r   rQ   rT   rU   rY   r]   r   r!   r"   r#   r   rP   rP   J   sg              r   rP   c                   s`  a  ] tR t^`t o ]]V 3R lR l4       4       t]]V 3R lR l4       4       t]]V 3R lR l4       4       t]]V 3R lR l4       4       t	]V 3R	 lR
 l4       t
]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       tRtV tR# )CacheInterfacec                r;   r<   r   r   r   r   r    CacheInterface.__annotate__c   s      K r   c                r5   r*   r   r/   r0   r   
collectionZCacheInterface.collectiona   r8   r   c                r;   r<   rP   r   r   r   r    r_   h   s      3 r   c                r5   r*   r   r/   r0   r   configZCacheInterface.configf   r8   r   c                r;   r<   r4   r   r   r   r    r_   m   s      !8 r   c                r5   r*   r   r/   r0   r   eviction_policyZCacheInterface.eviction_policyk   r8   r   c                r;   r<   rR   r   r   r   r    r_   r   s      c r   c                r5   r*   r   r/   r0   r   sizeZCacheInterface.sizep   r8   r   c                :   < V ^8  d   QhRS[ RS[S[R3,          /# r   keyr=   Nr   r	   r$   r   r   r   r    r_   v   s%      x E*d*:$; r   c                r5   r*   r   r,   rh   r2   r   getZCacheInterface.getu   r:   r   c                rV   r   entryr=   r$   rX   r   r   r   r    r_   z   s        r   c                r5   r*   r   r,   rm   r2   r   setZCacheInterface.sety   r:   r   c                F   < V ^8  d   QhRS[ S[,          RS[ S[,          /# r   
cache_keysr=   r   r   rX   r   r   r   r    r_   ~   s#      tH~ $t* r   c                r5   r*   r   )r,   rs   r2   r   delete_by_cache_keysZ#CacheInterface.delete_by_cache_keys}   r:   r   c                rq   r   r   r=   r   r)   rX   r   r   r   r    r_      s#      tE{ tDz r   c                r5   r*   r   )r,   r   r2   r   delete_by_redis_keysZ#CacheInterface.delete_by_redis_keys   r:   r   c                r;   r<   rR   r   r   r   r    r_      s      s r   c                r5   r*   r   r/   r0   r   flushZCacheInterface.flush   r:   r   c                rV   r   rh   r=   r   rX   r   r   r   r    r_      s      x D r   c                r5   r*   r   rj   r2   r   is_cachableZCacheInterface.is_cachable   r:   r   r   N)r   r   r   r   rN   r   r`   rb   rd   re   rk   rp   ru   rx   ry   r|   r   r!   r"   r#   r   r^   r^   `   s                            r   r^   c                   s  a  ] tR t^t o V 3R lR lt]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R	 lR
 l4       t	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )DefaultCachec                rJ   )r   cache_configr=   Nra   r   r   r   r    DefaultCache.__annotate__   s     + +1+ 
+r   c                s    \        4       V n        Wn        V P                  P                  4       P	                  4       V n        W P
                  n        R # r*   )r   _cache_cache_configrU   r9   _eviction_policyr6   r,   r~   r2   r   r-   ZDefaultCache.__init__   s?     "m) $ 2 2 F F H N N P&*#r   c                r;   r<   r   r   r   r   r    r      s      K r   c                    V P                   # r*   r   r/   r0   r   r`   ZDefaultCache.collection       {{r   c                r;   r<   ra   r   r   r   r    r      s     " "3 "r   c                r   r*   )r   r/   r0   r   rb   ZDefaultCache.config   s    !!!r   c                r;   r<   rc   r   r   r   r    r      s     % %!8 %r   c                r   r*   r   r/   r0   r   rd   ZDefaultCache.eviction_policy   s    $$$r   c                r;   r<   rR   r   r   r   r    r      s        c  r   c                s,    \        V P                  4      # r*   )lenr   r/   r0   r   re   ZDefaultCache.size   s    4;;r   c                rV   rl   rn   r   r   r   r    r      s     
 
 
 
r   c                sb   V P                  VP                  4      '       g   R # WP                  VP                  &   V P                  P	                  VP                  4       V P
                  P                  \        V P                  4      4      '       d   V P                  P                  4        R# )FT)	r|   r&   r   r   rM   r   rY   r   rB   ro   r2   r   rp   ZDefaultCache.set   sw    00',EOO$##EOO411#dkk2BCC!!,,.r   c                rf   rg   ri   r   r   r   r    r      s%      x E*d*:$; r   c                s    V P                   P                  VR 4      pVf   R # V P                  P                  V4       V# r*   )r   rk   r   rM   )r,   rh   rm   s   && r   rk   ZDefaultCache.get   s7    T*=##C(r   c                rq   rr   rt   r   r   r   r    r      s#     
 
tH~ 
$t* 
r   c                s    . pV FU  pV P                  V4      e/   V P                  P                  V4       VP                  R4       KD  VP                  R4       KW  	  V# )NTF)rk   r   popappend)r,   rs   responserh   s   &&  r   ru   Z!DefaultCache.delete_by_cache_keys   sN    Cxx}($%&  r   c                rq   rv   rw   r   r   r   r    r      s#      tE{ tDz r   c                sB   . p. pV Fp  p\        V\        4      '       d   VP                  4       pV P                   F7  pWEP                  9   g   K  VP                  V4       VP                  R 4       K9  	  Kr  	  V F  pV P                  P                  V4       K   	  V# )T)
isinstancer)   Zdecoder   r   r   r   )r,   r   r   Zkeys_to_deleteZ	redis_keyr&   rh   s   &&     r   rx   Z!DefaultCache.delete_by_redis_keys   s    #I)U++%,,.	![[	 4 44")))4OOD) ) $ "CKKOOC  " r   c                r;   r<   rR   r   r   r   r    r      s      s r   c                sd    \        V P                  4      pV P                  P                  4        V# r*   )r   r   Zclear)r,   Z
elem_count   & r   ry   ZDefaultCache.flush   s&    %
r   c                rV   rz   r{   r   r   r   r    r      s     C Cx CD Cr   c                sL    V P                   P                  VP                  4      # r*   )r   r]   r   rj   r2   r   r|   ZDefaultCache.is_cachable   s    !!55ckkBBr   )r   r   r   N)r   r   r   r   r-   rN   r`   rb   rd   re   rp   rk   ru   rx   ry   r|   r   r!   r"   r#   r   r}   r}      s     + +   " " % %    
 
 
 
 " 
C Cr   r}   c                   s   a  ] tR t^t o R t]R 4       t]P                  V 3R lR l4       t]V 3R lR l4       tV 3R lR lt	V 3R	 lR
 lt
V 3R lR ltR tRtV tR# )	LRUPolicyc                s    R V n         R # r*   )r6   r/   r0   r   r-   ZLRUPolicy.__init__   s	    
r   c                r   r*   r   r/   r0   r   r6   LRUPolicy.cache   r   r   c                r;   )r   r6   r^   r   r   r   r    LRUPolicy.__annotate__   s      > r   c                s    Wn         R # r*   r   )r,   r6   r2   r   r6   r      s    r   c                r;   r<   r>   r   r   r   r    r      s     - -( -r   c                s"    \         P                  # r*   )r   r   r/   r0   r   r@   ZLRUPolicy.type   s    !,,,r   c                r;   r<   rA   r   r   r   r    r      s      H r   c                s    V P                  4        V P                  P                  P                  R R7      pV^ ,          # )FZlast)_assert_cacher   r`   popitem)r,   popped_entryr   r   rB   ZLRUPolicy.evict_next   s5    {{--5555AAr   c                rC   rD   rF   r   r   r   r    r      s       X r   c                s(   V P                  4        V\        V P                  P                  4      8  d   \	        R 4      h. p\        V4       FA  pV P                  P                  P                  RR7      pVP                  V^ ,          4       KC  	  V# )z#Evictions count is above cache sizeFr   )r   r   r   r`   
ValueErrorZranger   r   )r,   rE   Zpopped_keysZ_r   s   &&   r   rI   ZLRUPolicy.evict_many   s{    3t{{--..BCCuA;;1199u9EL|A/  r   c                rJ   rK   rA   r   r   r   r    r     s     6 6x 6D 6r   c                s    V P                  4        V P                  P                  P                  V4      f   \	        R4      hV P                  P                  P                  V4       R # )Nz(Given entry does not belong to the cache)r   r   r`   rk   r   Zmove_to_endrL   r2   r   rM   ZLRUPolicy.touch  sM    ;;!!%%i08GHH**95r   c                sx    V P                   e!   \        V P                   \        4      '       g   \        R4      hR # )Nz6Eviction policy should be associated with valid cache.)r6   r   r^   r   r/   r0   r   r   ZLRUPolicy._assert_cache  s.    ::Z

N%K%KUVV &Lr   )r   r6   N)r   r   r   r   r-   rN   r6   rO   r@   rB   rI   rM   r   r   r!   r"   r#   r   r   r      st        \\  - - 
 6 6W Wr   r   c                   s    ] tR tRt]tRtR# )EvictionPolicyi  r   N)r   r   r   r   r   LRUr   r   r   r   r   r     s    
Cr   r   c                   s  a  ] tR tRt o ]t]P                  tRt	. RNRNRNRNRNRNR	NR
NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#NR$NR%NR&NR'NR(NR)NR*NR+NR,NR-NR.NR/NR0NR1NR2NR3NR4NR5NR6NR7NR8NR9NR:NR;NR<NR=NR>NR?NR@NRANRBNRCNRDNRENRFNRGNRHNRINRJNRKNRLNt
]	]]3V 3RM lRN lltRO tV 3RP lRQ ltV 3RR lRS ltV 3RT lRU ltV 3RV lRW ltRXtV tRY# )ZCacheConfigi  i'  ZBITCOUNTZBITFIELD_ROZBITPOSZEXISTSZGEODISTZGEOHASHZGEOPOSZGEORADIUSBYMEMBER_ROZGEORADIUS_ROZ	GEOSEARCHZGETZGETBITZGETRANGEZHEXISTSZHGETZHGETALLZHKEYSZHLENZHMGETZHSTRLENZHVALSzJSON.ARRINDEXzJSON.ARRLENzJSON.GETz	JSON.MGETzJSON.OBJKEYSzJSON.OBJLENz	JSON.RESPzJSON.STRLENz	JSON.TYPEZLCSZLINDEXZLLENZLPOSZLRANGEZMGETZSCARDZSDIFFZSINTERZ
SINTERCARDZ	SISMEMBERZSMEMBERSZ
SMISMEMBERZSORT_ROZSTRLENZSUBSTRZSUNIONzTS.GETzTS.INFOzTS.RANGEzTS.REVRANGEZTYPEZXLENZXPENDINGZXRANGEZXREADZ	XREVRANGEZZCARDZZCOUNTZZDIFFZZINTERZ
ZINTERCARDZ	ZLEXCOUNTZZMSCOREZZRANGEZZRANGEBYLEXZZRANGEBYSCOREZZRANKZ	ZREVRANGEZZREVRANGEBYLEXZZREVRANGEBYSCOREZZREVRANKZZSCOREZZUNIONc                r%   )r   max_sizecache_classrd   )rG   r   r   r   r   r   r    CacheConfig.__annotate__h  s)     0 00 0 (	0r   c                s*    W n         Wn        W0n        R # r*   )_cache_class	_max_sizer   )r,   r   r   rd   s   &&&&r   r-   ZCacheConfig.__init__h  s     (! /r   c                r   r*   )r   r/   r0   r   rQ   ZCacheConfig.get_cache_classr  s       r   c                r;   r<   rR   r   r   r   r    r   u  s      c r   c                r   r*   r   r/   r0   r   rT   ZCacheConfig.get_max_sizeu  s    ~~r   c                r;   r<   )r   r   r   r   r    r   x  s     % %^ %r   c                r   r*   r   r/   r0   r   rU   ZCacheConfig.get_eviction_policyx  s    $$$r   c                rV   rD   rW   r   r   r   r    r   {  s     & & & &r   c                s    WP                   8  # r*   r   rH   r2   r   rY   ZCacheConfig.is_exceeds_max_size{  s    ~~%%r   c                rV   rZ   r[   r   r   r   r    r   ~  s     2 23 24 2r   c                s    WP                   9   # r*   )DEFAULT_ALLOW_LISTr\   r2   r   r]   ZCacheConfig.is_allowed_to_cache~  s    1111r   )r   r   r   N)r   r   r   r   r}   ZDEFAULT_CACHE_CLASSr   r   ZDEFAULT_EVICTION_POLICYZDEFAULT_MAX_SIZEr   r-   rQ   rT   rU   rY   r]   r   r!   r"   r#   r   r   r     s    &,00KKK 	K 		K
 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K  	!K" 	#K$ 	%K& 	'K( 	)K* 	+K, 	-K. 	/K0 	1K2 	3K4 	5K6 	7K8 	9K: 	;K< 	=K> 	?K@ 	AKB 	CKD 	EKF 	GKH 	IKJ 	KKL 	MKN 	OKP 	QKR 	SKT 	UKV 	WKX 	YKZ 	[K\ 	]K^ 	_K` 	aKb 	cKd 	eKf 	gKh 	iKj 	kKl 	mKn 	oKp 	qKr 	sKt 	uKv 	wKx 	yKz 	{K| 	}K~ 	K@ 	AKB 	CKD 	EKF 	GKH 	IKJ 	KKL 	MKN 	OKP 	QKR 	SKT 	UK^ ).*A	0 0! % %& &2 2r   r   c                   s<   a  ] tR tRt o ]V 3R lR l4       tRtV tR# )CacheFactoryInterfacei  c                r;   r<   r   r   r   r   r    Z"CacheFactoryInterface.__annotate__  s      > r   c                r5   r*   r   r/   r0   r   	get_cacheZCacheFactoryInterface.get_cache  r:   r   r   N)r   r   r   r   r   r   r   r!   r"   r#   r   r   r     s      r   r   c                   sH   a  ] tR tRt o RV 3R lR lltV 3R lR ltRtV tR# )	CacheFactoryi  Nc                s0   < V ^8  d   QhRS[ S[,          /# )r   r~   )r   r   r   r   r   r    CacheFactory.__annotate__  s     ) )Xk%: )r   c                sP    Wn         V P                   f   \        4       V n         R # R # r*   )_configr   r   r2   r   r-   ZCacheFactory.__init__  s    #<<&=DL  r   c                r;   r<   r   r   r   r   r    r     s     6 6> 6r   c                s\    V P                   P                  4       pV! V P                   R 7      # ))r~   )r   rQ   )r,   r   r   r   r   ZCacheFactory.get_cache  s#    ll22455r   )r   r*   )r   r   r   r   r-   r   r   r!   r"   r#   r   r   r     s     ) )6 6r   r   N)Zabcr    r   Zcollectionsr   Zdataclassesr   Zenumr   Ztypingr   r   r   r	   r
   r   r   r$   r4   rP   r^   r}   r   r   r   r   r   r   r   r   <module>r      s    # # !  - - t  
( (
 $  
) ),c 8# ,+S +\RC> RCj,W' ,W^T i2- i2XC 	6( 	6r   