File: //opt/saltstack/salt/lib/python3.10/site-packages/cherrypy/lib/__pycache__/caching.cpython-310.pyc
o
�N�gmD � @ s� d Z ddlZddlZddlZddlZddlZddlmZmZ G dd� de �Z
G dd� de�ZG dd � d e
�Z
ddd
�Zdd� Zddd�ZdS )a
CherryPy implements a simple caching system as a pluggable Tool. This tool
tries to be an (in-process) HTTP/1.1-compliant cache. It's not quite there
yet, but it's probably good enough for most sites.
In general, GET responses are cached (along with selecting headers) and, if
another request arrives for the same resource, the caching Tool will return 304
Not Modified if possible, or serve the cached response otherwise. It also sets
request.cached to True if serving a cached representation, and sets
request.cacheable to False (so it doesn't get cached again).
If POST, PUT, or DELETE requests are made for a cached resource, they
invalidate (delete) any cached response.
Usage
=====
Configuration file example::
[/]
tools.caching.on = True
tools.caching.delay = 3600
You may use a class other than the default
:class:`MemoryCache<cherrypy.lib.caching.MemoryCache>` by supplying the config
entry ``cache_class``; supply the full dotted name of the replacement class
as the config value. It must implement the basic methods ``get``, ``put``,
``delete``, and ``clear``.
You may set any attribute, including overriding methods, on the cache
instance by providing them in config. The above sets the
:attr:`delay<cherrypy.lib.caching.MemoryCache.delay>` attribute, for example.
� N)�cptools�httputilc @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
S )�Cachez%Base class for Cache implementations.c C � t �)�6Return the current variant if in the cache, else None.��NotImplementedError��self� r �H/opt/saltstack/salt/lib/python3.10/site-packages/cherrypy/lib/caching.py�get0 � z Cache.getc C r )�'Store the current variant in the cache.r )r
�obj�sizer r r �put4 r z Cache.putc C r )�3Remove ALL cached variants of the current resource.r r r r r �delete8 r zCache.deletec C r )�,Reset the cache to its initial, empty state.r r r r r �clear<