Skip to main content

A few tools to cache interactions between your nameko services, increasing resiliency and performance at the expense of consistency, when it makes sense.

Project description

=============================
Nameko Cache Tools
=============================

.. image:: https://badge.fury.io/py/nameko-cachetools.png
:target: http://badge.fury.io/py/nameko-cachetools

.. image:: https://travis-ci.org/santiycr/nameko-cachetools.png?branch=master
:target: https://travis-ci.org/santiycr/nameko-cachetools

A few tools to cache interactions between your nameko services, increasing
resiliency and performance at the expense of consistency, when it makes sense.


To use Nameko Cache Tools in a project::



from nameko.rpc import rpc
from nameko_cachetools import CachedRpcProxy


class Service(object):
name = "demo"

other_service = CachedRpcProxy('other_service')

@rpc
def do_something(self, request):
# this rpc response will be cached first, then use the different
# cache strategies available in CachedRpcProxy or
# CacheFirstRpcProxy
other_service.do_something('hi')


Caching strategies:
-------------------


CachedRpcProxy
^^^^^^^^^^^^^^

If a cached version of this request exists, a response from the cache is
sent instead of hangling forever or raising an exception.

If a cached version doesn't exist, it will behave like a normal rpc,
and wait indefinitey for a reply. All successful replies are cached.

**WARNING**: Do NOT use this for setters, rpcs meant to modify state in the
target service

Arguments:

cache
the cache to use. This should resemble a dict but can be more
sophisticated, like the caches provided by the cachetools package.

failover_timeout
if a cached version of this query exists, how long
in seconds should your original request wait until it deems the target
service as unresponsive and moves on to use a cached response

CacheFirstRpcProxy
^^^^^^^^^^^^^^^^^^

Stores responses from the original services and keeps them cached.

If further requests come in with the same arguments and found in the cache,
a response from the cache is sent instead of hitting the destination service.

**WARNING**: Do NOT use this for setters, rpcs meant to modify state in the
target service

Arguments:

cache
the cache to use. This should resemble a dict but can be more
sophisticated, like the caches provided by the cachetools package.




Documentation
-------------

The full documentation is at http://nameko-cachetools.rtfd.org.



History
-------

0.1.0 (2018-06-10)
++++++++++++++++++

* First release on PyPI.

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-cachetools-0.5.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

nameko_cachetools-0.5.0-py2.py3-none-any.whl (4.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file nameko-cachetools-0.5.0.tar.gz.

File metadata

File hashes

Hashes for nameko-cachetools-0.5.0.tar.gz
Algorithm Hash digest
SHA256 aacc20518573641d21fdd1003c0d5f5045b34a824eddcabd41df581cade3c67d
MD5 9e3b1f5773b6ac0cbb28f92e1db61b55
BLAKE2b-256 dd869815aa8258b31a4883d984494356c26f76c183abf92efdad1dac1da99b3a

See more details on using hashes here.

File details

Details for the file nameko_cachetools-0.5.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for nameko_cachetools-0.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 68aca584179eaee6d81439ec169d6e56c313c74727ef1fa6d2bb7a7dfb4de788
MD5 9e0861071fe13a0b8ccd7eaa188feb77
BLAKE2b-256 fbf44c645f224fbe091e0c4b06440e773e897149c69d374ed9977e5039b776e8

See more details on using hashes here.

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