expiring-cache-1.0.0
توضیحات
A simple Python dict with TTL support for auto-expiring caches with support for case-insensitive keys.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | expiring-cache-1.0.0 |
| نام | expiring-cache |
| نسخه کتابخانه | 1.0.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | ItsArtemiz |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/ItsArtemiz/expiring-cache |
| آدرس اینترنتی | https://pypi.org/project/expiring-cache/ |
| مجوز | MIT |
# expiring-cache
A simple Python dict with TTL support for auto-expiring caches with support for case-insensitive keys.
## Installation
```python
pip install expiring-cache
```
## Features
- TTL support for auto-caching
- Case-insensitive keys support
## Usage
Example 1:
```python
import time
from cache import ExpiringCache
cache = ExpiringCache(2) # Keys will exist for 2 seconds.
cache['ABC'] = 'Example value'
print(cache['ABC']) # Prints the 'Example Value'
time.sleep(2)
print(cache['ABC']) # Raises KeyError
```
Example 2: (shows case-insensitive feature)
```python
import time
from cache import ExpiringCache
cache = ExpiringCache(2, case_insensitive=True)
cache['ABC'] = 'Example value'
print(cache['ABC'])
print(cache['abc'])
# Both print statements above print the exact same 'Example Value'
time.sleep(2)
print(cache['ABC'])
print(cache['abc'])
# Both the print statements above raise KeyError
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >3.7.0 | Python |
نحوه نصب
نصب پکیج whl expiring-cache-1.0.0:
pip install expiring-cache-1.0.0.whl
نصب پکیج tar.gz expiring-cache-1.0.0:
pip install expiring-cache-1.0.0.tar.gz