Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

apinanyogaratnam/cachier-python

Repository files navigation

Cachier Python

A python library wrapper for using a self-hosted cachier service.

URL: cachier-python

Table of Contents

Installation

Install the package from pypi:

pip install cachier-python

Usage

from cachier_python import Cachier, DriverType

# Create a cachier instance to connect to the service
client = Cachier('http://localhost:8000', driver=DriverType.RAM)

# cache expiry in seconds
CACHIER_EXPIRY = 600

# set the cache
client.set(key='my_key', value='my_value', expiry=CACHIER_EXPIRY)

# get the cached value
cached_value = client.get(key='my_key')

Available drivers:

from cachier_python import DriverType

DriverType.RAM
DriverType.JSON
DriverType.SQLITE
DriverType.PICKLE

check if a driver is valid:

from cachier_python import DriverType

is_valid = DriverType().is_valid(DriverType.RAM)

print(is_valid)

Support

Please open an issue for support.

Contributing

Please contribute using Github Flow. Create a branch, add commits, and open a pull request. -->