All Projects → youknowone → Ring

youknowone / Ring

Licence: other
Python cache interface with clean API and built-in memcache & redis + asyncio support.

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects
python2
120 projects

Projects that are alternatives of or similar to Ring

Overlord
Overlord是哔哩哔哩基于Go语言编写的memcache和redis&cluster的代理及集群管理功能,致力于提供自动化高可用的缓存服务解决方案。
Stars: ✭ 1,884 (+366.34%)
Mutual labels:  redis, cache, memcache
Synchrotron
Caching layer load balancer.
Stars: ✭ 42 (-89.6%)
Mutual labels:  redis, cache, memcache
Gocache
☔️ A complete Go cache library that brings you multiple ways of managing your caches
Stars: ✭ 775 (+91.83%)
Mutual labels:  redis, cache, memcache
Aiocache
Asyncio cache manager for redis, memcached and memory
Stars: ✭ 496 (+22.77%)
Mutual labels:  asyncio, redis, cache
Redisson
Redisson - Redis Java client with features of In-Memory Data Grid. Over 50 Redis based Java objects and services: Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Publish / Subscribe, Bloom filter, Spring Cache, Tomcat, Scheduler, JCache API, Hibernate, MyBatis, RPC, local cache ...
Stars: ✭ 17,972 (+4348.51%)
Mutual labels:  redis, cache
Scrapbook
PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APC(u), SQL and additional capabilities (e.g. transactions, stampede protection) built on top.
Stars: ✭ 279 (-30.94%)
Mutual labels:  redis, cache
Endoflife.date
Informative site with EoL dates of everything
Stars: ✭ 296 (-26.73%)
Mutual labels:  redis, django
Awesome Cheatsheets
👩‍💻👨‍💻 Awesome cheatsheets for popular programming languages, frameworks and development tools. They include everything you should know in one single file.
Stars: ✭ 26,007 (+6337.38%)
Mutual labels:  redis, django
Aioredlock
🔒 The asyncio implemetation of Redis distributed locks
Stars: ✭ 171 (-57.67%)
Mutual labels:  asyncio, redis
Cache
Cache library
Stars: ✭ 310 (-23.27%)
Mutual labels:  redis, cache
Cache
Cache library with Redis backend for Golang
Stars: ✭ 337 (-16.58%)
Mutual labels:  redis, cache
Jetcache
JetCache is a Java cache framework.
Stars: ✭ 3,167 (+683.91%)
Mutual labels:  redis, cache
memoize
Caching library for asynchronous Python applications.
Stars: ✭ 53 (-86.88%)
Mutual labels:  cache, asyncio
Senparc.co2net
支持 .NET Framework & .NET Core 的公共基础扩展库
Stars: ✭ 289 (-28.47%)
Mutual labels:  redis, cache
Bolt Python
A framework to build Slack apps using Python
Stars: ✭ 190 (-52.97%)
Mutual labels:  asyncio, django
Koa Redis
Redis storage for Koa session middleware/cache with Sentinel and Cluster support
Stars: ✭ 324 (-19.8%)
Mutual labels:  redis, cache
Ssm booksystem
ssm demo,ssm详细教程,SSM简明教程:简单的十步教你搭建人生第一个SSM框架[ SSM框架整合教程(spring+spring mvc+mybatis+redis+maven+idea+bootstrap) ]
Stars: ✭ 355 (-12.13%)
Mutual labels:  redis, cache
Kache
A simple in memory cache written using go
Stars: ✭ 349 (-13.61%)
Mutual labels:  redis, cache
Django Watchman
django-watchman exposes a status endpoint for your backing services like databases, caches, etc.
Stars: ✭ 357 (-11.63%)
Mutual labels:  cache, django
Django Private Chat
Django one-to-one Websocket-based Asyncio-handled chat, developed by Bearle team
Stars: ✭ 376 (-6.93%)
Mutual labels:  asyncio, django

Ring

.. image:: https://badges.gitter.im/ring-cache/community.svg :alt: Join the chat at https://gitter.im/ring-cache/community :target: https://gitter.im/ring-cache/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

.. image:: https://travis-ci.org/youknowone/ring.svg?branch=master :target: https://travis-ci.org/youknowone/ring .. image:: https://codecov.io/gh/youknowone/ring/graph/badge.svg :target: https://codecov.io/gh/youknowone/ring

Let's concentrate on code, not on storages.

Ring shows a way to control cache in point of view of code - not about storages. Ring's decorator is convenient but also keeps fluency for general scenarios.

asyncio support for Python3.5+!

Take advantage of perfectly explicit and fully automated cache interface. Ring decorators convert your functions to cached version of them, with extra control methods.

Documentation

Full documentation with examples and references: <http://ring-cache.readthedocs.io/>_

  • Function/method support.
  • asyncio support.
  • Django support.
  • Bulk access support.

Function cache

.. code:: python

import ring
import memcache
import requests

mc = memcache.Client(['127.0.0.1:11211'])

# working for mc, expire in 60sec
@ring.memcache(mc, time=60)
def get_url(url):
    return requests.get(url).content

# normal way - it is cached
data = get_url('http://example.com')

It is a normal smart cache flow.

But ring is different when you want to explicitly control it.

.. code:: python

# delete the cache
get_url.delete('http://example.com')
# get cached data or None
data_or_none = get_url.get('http://example.com')

# get internal cache key
key = get_url.key('http://example.com')
# and access directly to the backend
direct_data = mc.get(key)

Method cache

.. code:: python

import ring
import redis

rc = redis.StrictRedis()

class User(dict):
    def __ring_key__(self):
        return self['id']

    # working for rc, no expiration
    # using json coder for non-bytes cache data
    @ring.redis(rc, coder='json')
    def data(self):
        return self.copy()

    # parameters are also ok!
    @ring.redis(rc, coder='json')
    def child(self, child_id):
        return {'user_id': self['id'], 'child_id': child_id}

user = User(id=42, name='Ring')

# create and get cache
user_data = user.data()  # cached
user['name'] = 'Ding'
# still cached
cached_data = user.data()
assert user_data == cached_data
# refresh
updated_data = user.data.update()
assert user_data != updated_data

# id is the cache key so...
user2 = User(id=42)
# still hitting the same cache
assert updated_data == user2.data()

Installation

PyPI is the recommended way.

.. sourcecode:: shell

$ pip install ring

To browse versions and tarballs, visit: <https://pypi.python.org/pypi/ring/>_

To use memcached or redis, don't forget to install related libraries. For example: python-memcached, python3-memcached, pylibmc, redis-py, Django etc

It may require to install and run related services on your system too. Look for memcached and redis for your system.

Contributors

See contributors list on: <https://github.com/youknowone/ring/graphs/contributors>_

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].