IoT LRU Cache Library for Python
Project description
iot-lru-cache
This package is an implementation of a Least Recently Used (LRU) caching algorithm for optimized caching on an IoT edge device.
Official Documentation | Source code | Package PyPI
Table of Contents
Versioning
This repository adheres to Semantic Versioning. It will be maintained through the CHANGELOG.md
and in GitHub Releases. It's important to note that you must maintain the version with your releases in iot/lru/cache/_version.py
, otherwise a new package version will fail to get published.
Getting Started
This section provides basic examples with the iot-lru-cache
.
Prerequisites
- Python 3.7 or later is required to use this package.
Basic Examples
- Install via pip:
pip install iot-lru-cache
- Import and say hello:
from iot.lru.cache import __version__
print(f"hello world from iot-lru-cache version: {__version__}")
- Basic usage:
from iot.lru.cache import IoTLRUCache
# instantiate cache
cache = IoTLRUCache(capacity=100)
# print info w/ repr
print(f"{cache.__repr__()}")
# add a key-value pair to the cache
cache.put(key="my_key", value={"my": "value"})
# retrieve the value for a given key (returns -1 if not found)
val = cache.get(key="my_key")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
iot-lru-cache-1.0.0.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for iot_lru_cache-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3689d13e30dd8ef31a37f1da6af08ee2f4e96951f0001f835d9ce58c1e09fad |
|
MD5 | 8c9189e4b98e9fa3a6659194dd6bbf7f |
|
BLAKE2b-256 | 02b7b95df2d8a2ec2295403aa79a05be937dfe271d02f5aab14b4bd95b81b475 |