db_cache

database caching for dynamic programming


Keywords
db_cache
License
MIT
Install
pip install db_cache==0.1.1

Documentation

DB Cache

Documentation Status Updates

database caching for dynamic programming

Intro

Guide

TL;DR

import db_cache

# Instantiate cache object that connects to PostgreSQL with provided credential
cache = db_cache.Cache(database="db_name", user="admin", password="12345", host="localhost")

# Create decorater that cache function result using provided table name
@cache.use_table("some_table_name")
def some_expensive_function(large_int):
    prime1, prime2 = factoring(large_int)
    return (prime1, prime2)

# Return cached value if possible, otherwise compute and cache result.
some_expensive_function(121103)

Features

  • TODO

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.