Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/dogpile/cache/__pycache__/region.cpython-39.pyc
Ðазад
a t�hd � @ s� d dl mZ d dlZd dlZd dlmZ d dlmZ d dlZd dlZd dl m Z d dlZd dlZd dl mZ d dl mZ d dl mZ d d l mZ d d l mZ d dl mZ d dl mZ d d l mZ d dl mZ d dl mZ d dlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddlm!Z! ddlm"Z" ddlm#Z# ddlm$Z$ ddlm%Z% ddlm&Z& ddlm'Z' ddlm(Z( ddlm)Z) dd l*m+Z+ dd!l*m,Z, dd"l-m.Z. dd#l/m0Z0 dd$l/m1Z1 dd%l/m2Z2 d&d'lm3Z3 d&d(lm4Z4 d&d)l/m5Z5 d&d*l/m6Z6 d&d+l/m7Z7 d&d,l/m8Z8 d&d-l9m:Z: d&Z;e�<e=�Z>ed.e#eg e)f e gdf Z?eg e@f ZAeegeBf ZCed/ed/e#f f ZDed/ed/ee# f f ZEG d0d1� d1�ZFG d2d3� d3eF�ZGG d4d.� d.�ZHd5d5d.d6�d7d8�ZIdS )9� )�annotationsN)�partial��wraps)�Number)�Any)�Callable)�cast)�Mapping)�Optional)�Sequence)�Tuple)�Type)� TYPE_CHECKING)�Union)�decorate� )� exception)�BackendArguments)�BackendFormatted)�CachedValue)� CacheMutex)�CacheReturnType)�CantDeserializeException)�KeyType)�MetaDataType��NO_VALUE)�NoValueType)�SerializedReturnType)� Serializer)�ValuePayload)�_backend_loader)�register_backend)�ProxyBackend)�function_key_generator)�function_multi_key_generator)�repr_obj� )�Lock)�NeedRegenerationException)�coerce_string_conf)�memoized_property)�NameRegistry)�PluginLoader)�Self�CacheRegion.c @ sn e Zd ZdZdddd�dd�Zddd �d d�Zddd �dd �Zddd �dd�Zdd�dd�Zdd�dd�Z dS )�RegionInvalidationStrategya? Region invalidation strategy interface Implement this interface and pass implementation instance to :meth:`.CacheRegion.configure` to override default region invalidation. Example:: class CustomInvalidationStrategy(RegionInvalidationStrategy): def __init__(self): self._soft_invalidated = None self._hard_invalidated = None def invalidate(self, hard=None): if hard: self._soft_invalidated = None self._hard_invalidated = time.time() else: self._soft_invalidated = time.time() self._hard_invalidated = None def is_invalidated(self, timestamp): return ((self._soft_invalidated and timestamp < self._soft_invalidated) or (self._hard_invalidated and timestamp < self._hard_invalidated)) def was_hard_invalidated(self): return bool(self._hard_invalidated) def is_hard_invalidated(self, timestamp): return (self._hard_invalidated and timestamp < self._hard_invalidated) def was_soft_invalidated(self): return bool(self._soft_invalidated) def is_soft_invalidated(self, timestamp): return (self._soft_invalidated and timestamp < self._soft_invalidated) The custom implementation is injected into a :class:`.CacheRegion` at configure time using the :paramref:`.CacheRegion.configure.region_invalidator` parameter:: region = CacheRegion() region = region.configure(region_invalidator=CustomInvalidationStrategy()) # noqa Invalidation strategies that wish to have access to the :class:`.CacheRegion` itself should construct the invalidator given the region as an argument:: class MyInvalidator(RegionInvalidationStrategy): def __init__(self, region): self.region = region # ... # ... region = CacheRegion() region = region.configure(region_invalidator=MyInvalidator(region)) .. versionadded:: 0.6.2 .. seealso:: :paramref:`.CacheRegion.configure.region_invalidator` T�bool�None��hard�returnc C s t � �dS )z�Region invalidation. :class:`.CacheRegion` propagated call. The default invalidation system works by setting a current timestamp (using ``time.time()``) to consider all older timestamps effectively invalidated. N��NotImplementedError��selfr5 � r; ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/dogpile/cache/region.py� invalidate� s z%RegionInvalidationStrategy.invalidate�float�� timestampr6 c C s t � �dS )z�Check timestamp to determine if it was hard invalidated. :return: Boolean. True if ``timestamp`` is older than the last region invalidation time and region is invalidated in hard mode. Nr7 �r: r@ r; r; r<