How to use the ring.func.asyncio.create_asyncio_factory_proxy 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 / ring / func / __init__.py View on Github external
from ring.func import sync

try:
    import asyncio as _has_asyncio
except ImportError:
    _has_asyncio = False
else:
    from ring.func import asyncio


__all__ = (
    'lru', 'dict', 'memcache', 'redis', 'redis_hash', 'shelve', 'disk')


if _has_asyncio:
    lru = asyncio.create_asyncio_factory_proxy(
        (sync.lru, asyncio.create_factory_from(sync.lru, sync.LruStorage)),
        support_asyncio=False)
    dict = asyncio.create_asyncio_factory_proxy(
        (sync.dict, asyncio.dict),
        support_asyncio=True)
    shelve = asyncio.create_asyncio_factory_proxy(
        (sync.shelve, asyncio.create_factory_from(sync.shelve, sync.ShelveStorage)),
        support_asyncio=False)
    disk = asyncio.create_asyncio_factory_proxy(
        (sync.diskcache, asyncio.create_factory_from(sync.diskcache, sync.DiskCacheStorage)),
        support_asyncio=False)
    memcache = asyncio.create_asyncio_factory_proxy(
        (sync.memcache, asyncio.aiomcache),
        support_asyncio=True)
    redis = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py, asyncio.aioredis),
github youknowone / ring / ring / func / __init__.py View on Github external
lru = asyncio.create_asyncio_factory_proxy(
        (sync.lru, asyncio.create_factory_from(sync.lru, sync.LruStorage)),
        support_asyncio=False)
    dict = asyncio.create_asyncio_factory_proxy(
        (sync.dict, asyncio.dict),
        support_asyncio=True)
    shelve = asyncio.create_asyncio_factory_proxy(
        (sync.shelve, asyncio.create_factory_from(sync.shelve, sync.ShelveStorage)),
        support_asyncio=False)
    disk = asyncio.create_asyncio_factory_proxy(
        (sync.diskcache, asyncio.create_factory_from(sync.diskcache, sync.DiskCacheStorage)),
        support_asyncio=False)
    memcache = asyncio.create_asyncio_factory_proxy(
        (sync.memcache, asyncio.aiomcache),
        support_asyncio=True)
    redis = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py, asyncio.aioredis),
        support_asyncio=True)
    redis_hash = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py_hash, asyncio.aioredis_hash),
        support_asyncio=True)
else:
    from .sync import (
        lru, dict, shelve, diskcache as disk, memcache,
github youknowone / ring / ring / func / __init__.py View on Github external
else:
    from ring.func import asyncio


__all__ = (
    'lru', 'dict', 'memcache', 'redis', 'redis_hash', 'shelve', 'disk')


if _has_asyncio:
    lru = asyncio.create_asyncio_factory_proxy(
        (sync.lru, asyncio.create_factory_from(sync.lru, sync.LruStorage)),
        support_asyncio=False)
    dict = asyncio.create_asyncio_factory_proxy(
        (sync.dict, asyncio.dict),
        support_asyncio=True)
    shelve = asyncio.create_asyncio_factory_proxy(
        (sync.shelve, asyncio.create_factory_from(sync.shelve, sync.ShelveStorage)),
        support_asyncio=False)
    disk = asyncio.create_asyncio_factory_proxy(
        (sync.diskcache, asyncio.create_factory_from(sync.diskcache, sync.DiskCacheStorage)),
        support_asyncio=False)
    memcache = asyncio.create_asyncio_factory_proxy(
        (sync.memcache, asyncio.aiomcache),
        support_asyncio=True)
    redis = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py, asyncio.aioredis),
        support_asyncio=True)
    redis_hash = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py_hash, asyncio.aioredis_hash),
        support_asyncio=True)
else:
    from .sync import (
github youknowone / ring / ring / func / __init__.py View on Github external
if _has_asyncio:
    lru = asyncio.create_asyncio_factory_proxy(
        (sync.lru, asyncio.create_factory_from(sync.lru, sync.LruStorage)),
        support_asyncio=False)
    dict = asyncio.create_asyncio_factory_proxy(
        (sync.dict, asyncio.dict),
        support_asyncio=True)
    shelve = asyncio.create_asyncio_factory_proxy(
        (sync.shelve, asyncio.create_factory_from(sync.shelve, sync.ShelveStorage)),
        support_asyncio=False)
    disk = asyncio.create_asyncio_factory_proxy(
        (sync.diskcache, asyncio.create_factory_from(sync.diskcache, sync.DiskCacheStorage)),
        support_asyncio=False)
    memcache = asyncio.create_asyncio_factory_proxy(
        (sync.memcache, asyncio.aiomcache),
        support_asyncio=True)
    redis = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py, asyncio.aioredis),
        support_asyncio=True)
    redis_hash = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py_hash, asyncio.aioredis_hash),
        support_asyncio=True)
else:
    from .sync import (
        lru, dict, shelve, diskcache as disk, memcache,
github youknowone / ring / ring / func / __init__.py View on Github external
__all__ = (
    'lru', 'dict', 'memcache', 'redis', 'redis_hash', 'shelve', 'disk')


if _has_asyncio:
    lru = asyncio.create_asyncio_factory_proxy(
        (sync.lru, asyncio.create_factory_from(sync.lru, sync.LruStorage)),
        support_asyncio=False)
    dict = asyncio.create_asyncio_factory_proxy(
        (sync.dict, asyncio.dict),
        support_asyncio=True)
    shelve = asyncio.create_asyncio_factory_proxy(
        (sync.shelve, asyncio.create_factory_from(sync.shelve, sync.ShelveStorage)),
        support_asyncio=False)
    disk = asyncio.create_asyncio_factory_proxy(
        (sync.diskcache, asyncio.create_factory_from(sync.diskcache, sync.DiskCacheStorage)),
        support_asyncio=False)
    memcache = asyncio.create_asyncio_factory_proxy(
        (sync.memcache, asyncio.aiomcache),
        support_asyncio=True)
    redis = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py, asyncio.aioredis),
        support_asyncio=True)
    redis_hash = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py_hash, asyncio.aioredis_hash),
        support_asyncio=True)
else:
    from .sync import (
        lru, dict, shelve, diskcache as disk, memcache,
github youknowone / ring / ring / func / __init__.py View on Github external
import asyncio as _has_asyncio
except ImportError:
    _has_asyncio = False
else:
    from ring.func import asyncio


__all__ = (
    'lru', 'dict', 'memcache', 'redis', 'redis_hash', 'shelve', 'disk')


if _has_asyncio:
    lru = asyncio.create_asyncio_factory_proxy(
        (sync.lru, asyncio.create_factory_from(sync.lru, sync.LruStorage)),
        support_asyncio=False)
    dict = asyncio.create_asyncio_factory_proxy(
        (sync.dict, asyncio.dict),
        support_asyncio=True)
    shelve = asyncio.create_asyncio_factory_proxy(
        (sync.shelve, asyncio.create_factory_from(sync.shelve, sync.ShelveStorage)),
        support_asyncio=False)
    disk = asyncio.create_asyncio_factory_proxy(
        (sync.diskcache, asyncio.create_factory_from(sync.diskcache, sync.DiskCacheStorage)),
        support_asyncio=False)
    memcache = asyncio.create_asyncio_factory_proxy(
        (sync.memcache, asyncio.aiomcache),
        support_asyncio=True)
    redis = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py, asyncio.aioredis),
        support_asyncio=True)
    redis_hash = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py_hash, asyncio.aioredis_hash),
github youknowone / ring / ring / func / __init__.py View on Github external
dict = asyncio.create_asyncio_factory_proxy(
        (sync.dict, asyncio.dict),
        support_asyncio=True)
    shelve = asyncio.create_asyncio_factory_proxy(
        (sync.shelve, asyncio.create_factory_from(sync.shelve, sync.ShelveStorage)),
        support_asyncio=False)
    disk = asyncio.create_asyncio_factory_proxy(
        (sync.diskcache, asyncio.create_factory_from(sync.diskcache, sync.DiskCacheStorage)),
        support_asyncio=False)
    memcache = asyncio.create_asyncio_factory_proxy(
        (sync.memcache, asyncio.aiomcache),
        support_asyncio=True)
    redis = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py, asyncio.aioredis),
        support_asyncio=True)
    redis_hash = asyncio.create_asyncio_factory_proxy(
        (sync.redis_py_hash, asyncio.aioredis_hash),
        support_asyncio=True)
else:
    from .sync import (
        lru, dict, shelve, diskcache as disk, memcache,