Skip to main content

A postgresql backed cache system

Project description

DBCACHE

This small library allows to cache costly things within a postgresql table.

keys and values are bytes.

Example usage:

  from time import sleep
  from datetime import timedelta
  from dbcache.api import dbcache

  cache = dbcache('postgresql://foo:bar@postgresql/mydb')

  assert cache.get(b'a') is None
  cache.set(b'a', b'aaa')
  assert cache.get(b'a') == b'aaa'

  cache.set(b'b', b'bbb', lifetime=timedelta(seconds=1))
  assert cache.get(b'b') == b'bbb'
  sleep(1)
  assert cache.get(b'b') is None

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dbcache, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size dbcache-0.1.0-py3-none-any.whl (3.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page