Skip to main content

Cache for nameko services

Project description

nameko-cache

Cache for nameko services

Installation

pip install nameko-cache

Usage

app.py

from datetime import datetime
from nameko.rpc import rpc
from nameko_redisy import Redis
from nameko_cache import cached, delete_cached


class FooService(object):
    name = 'foo_service'

    cache = Redis('CACHE_REDIS_URI')

    @rpc
    @cached(timeout=10)
    def hello(name):
        return 'hello {} at {}'.format(name, datetime.now())


    @rpc
    def world(self):
        delete_cached(self.hello, ['john'])

config.yml

AMQP_URI: 'pyamqp://guest:guest@localhost'
CACHE_REDIS_URI: 'redis://127.0.0.1'

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

nameko-cache-1.0.6.win32.zip (3.7 kB view hashes)

Uploaded Source

Built Distribution

nameko_cache-1.0.6-py2-none-any.whl (2.3 kB view hashes)

Uploaded Python 2

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