PHP 8.2.30
Preview: cache.py Size: 790 B
/usr/lib/python3.6/site-packages/pip/_vendor/cachecontrol/cache.py

"""
The cache object API for implementing caches. The default is a thread
safe in-memory dictionary.
"""
from threading import Lock


class BaseCache(object):

    def get(self, key):
        raise NotImplemented()

    def set(self, key, value):
        raise NotImplemented()

    def delete(self, key):
        raise NotImplemented()

    def close(self):
        pass


class DictCache(BaseCache):

    def __init__(self, init_dict=None):
        self.lock = Lock()
        self.data = init_dict or {}

    def get(self, key):
        return self.data.get(key, None)

    def set(self, key, value):
        with self.lock:
            self.data.update({key: value})

    def delete(self, key):
        with self.lock:
            if key in self.data:
                self.data.pop(key)

Directory Contents

Dirs: 2 × Files: 10

Name Size Perms Modified Actions
caches DIR
- drwxr-xr-x 2024-06-15 07:03:53
Edit Download
- drwxr-xr-x 2024-06-15 07:03:53
Edit Download
4.50 KB lrw-r--r-- 2024-04-06 13:40:45
Edit Download
790 B lrw-r--r-- 2024-04-06 13:40:45
Edit Download
380 B lrw-r--r-- 2024-04-06 13:40:45
Edit Download
12.72 KB lrw-r--r-- 2024-04-06 13:40:45
Edit Download
2.47 KB lrw-r--r-- 2024-04-06 13:40:45
Edit Download
4.04 KB lrw-r--r-- 2024-04-06 13:40:45
Edit Download
6.38 KB lrw-r--r-- 2024-04-06 13:40:45
Edit Download
498 B lrw-r--r-- 2024-04-06 13:40:45
Edit Download
1.29 KB lrw-r--r-- 2024-04-06 13:40:45
Edit Download
302 B lrw-r--r-- 2024-04-06 13:40:45
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).