How to use the ring.dict function in ring

To help you get started, we’ve selected a few ring examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github youknowone / ring / tests / test_func_sync.py View on Github external
def storage_dict():
    storage = StorageDict()
    storage.ring = ring.dict
    storage.is_binary = False
    storage.has_has = True
    storage.has_touch = True
    storage.has_expire = True
    return storage
github youknowone / ring / tests / test_key.py View on Github external
    @ring.dict({}, ignorable_keys=['ignorable'])
    def f(n, ignorable):
        return n + ignorable
github youknowone / ring / tests / _test_func_async_def.py View on Github external
    @ring.dict({})
    async def g(a: int, b: str) -> float:
        pass
github youknowone / ring / tests / test_ring.py View on Github external
def test_proxy_repr():

    @ring.dict({})
    def f():
        pass

    assert repr(ring.dict)
    assert repr(ring.dict({}))
    assert repr(f)
github youknowone / ring / tests / test_memoize.py View on Github external
    @ring.dict(cache, ignorable_keys=['use_cache'])
    def fibonacci(n, use_cache):
        if use_cache:
            raise RuntimeError('it is not cached!')
        if n <= 1:
            return n
        return fibonacci(n - 2, use_cache) + fibonacci(n - 1, use_cache)
github youknowone / ring / tests / test_ignorable_keys.py View on Github external
    @ring.dict({}, ignorable_keys=['ignorable'])
    def f(n, ignorable):
        return n + ignorable
github youknowone / ring / tests / test_func_sync.py View on Github external
    @ring.dict(cache, expire=1)
    def f(a, b):
        return a * 100 + b
github youknowone / ring / tests / _test_func_asyncio.py View on Github external
        @ring.dict(storage)
        @classmethod
        @asyncio.coroutine
        def cmethod(cls, a, b):
            return base + a * 200 + b
github youknowone / ring / tests / test_workflow.py View on Github external
        @ring.dict(cache)
        def child(self, n):
            return {'child_id': self.user_id * 10000 + n}