Skip to main content

IoT LRU Cache Library for Python

Project description

iot-lru-cache

python version pre-commit Keep a Changelog CI_CD GitHub_Actions package PyPI

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

  1. Install via pip:
pip install iot-lru-cache
  1. Import and say hello:
from iot.lru.cache import __version__

print(f"hello world from iot-lru-cache version: {__version__}")
  1. 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


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)

Uploaded Source

Built Distribution

iot_lru_cache-1.0.0-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page