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.
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
Built Distribution
File details
Details for the file nameko-cachetools-0.4.0.tar.gz
.
File metadata
- Download URL: nameko-cachetools-0.4.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0d0aeb264fe253bae66a577b3efebfc62da4f64e27096edeeca7ea62fab1924 |
|
MD5 | f138f722292ee9ba7048cc7df3b69490 |
|
BLAKE2b-256 | 79782b5d392a7b74972dd5726b70ff84415f3f348c7d6dc984c0d1aba20520c2 |
File details
Details for the file nameko_cachetools-0.4.0-py2.py3-none-any.whl
.
File metadata
- Download URL: nameko_cachetools-0.4.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcea75b54a1bbfa08c32a92911e06b51c7f98fc434eddeaff30a60e964eb7472 |
|
MD5 | df9fc11252ad2deb9510e073f4a22b70 |
|
BLAKE2b-256 | 65d61d27db482242fbb359011055f3d82d3de3ca799983f829f280e53d1542e4 |