This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description

YoTon is an util for cache, it simplifies cache with a decorator.


$ pip install yoton


redis_server_config = {
    "default": {
        "host": "localhost",
        "port": 6379,
        "db": 1
    "server_a": {
        "host": "localhost",
        "port": 6378,
        "db": 2,
yoton = YoTon(redis_server_config)

Apply To Function

@yoton.cache(key_pattern="dummy_cache_key", expire_seconds=60)
def dummy_func():
    return "hello"

>> dummy_func()  # call the function
"hello" set in the cache

Key Pattern

The cache key is using python’s string format syntax, you can find it here

@youton.cache(key_pattern="dummy:{a}_{b}_{c}", expire_seconds=60)
def dummy_func_with_params(a, b, c=3):
    return a + b + c

Complex object in parameters

@youton.cache(key_pattern="dummy:{}_{}", expire_seconds=60)
def dummy_func_with_params(a, b):
    return a + b

Select Database

@yoton.cache(key_pattern="dummy_cache_key", database="test", expire_seconds=60)
def dummy_func_database():
    return "hello"

Customized Formatter

@yoton.cache(key_pattern="dummy_cache_key", key_formatter=CustomizedFormatter(), expire_seconds=60)
def dummy_func_keyforamtter():

Apply Cache To Instance Method

class DummyClass(object):

    def instance_method(self):
        return "hello"


# call the function directly without touch cache, b=2, c=3)

# refresh cache data
dummy_func_with_params.refresh_cache(a=1, b=2, c=3)

# remove data in cache
dummy_func_with_params.delete_cache(a=1, b=2, c=3)
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
yoton-0.1.0-py2.7.egg (7.9 kB) Copy SHA256 Checksum SHA256 2.7 Egg Mar 26, 2016
yoton-0.1.0.tar.gz (4.2 kB) Copy SHA256 Checksum SHA256 Source Mar 26, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting