博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
retools 0.1 : Python Package Index
阅读量:6293 次
发布时间:2019-06-22

本文共 1803 字,大约阅读时间需要 6 分钟。

retools 0.1

Redis Tools

Latest Version:

Redis Tools (retools)

retools is a package of Redis tools. It's aim is to provide a variety of

Redis backed Python tools that are always 100% unit tested, fast, efficient,
and utilize the capabilities of Redis.

Current tools in retools:

  • Caching
  • Global Lock

On the horizon for future implementation:

  • A worker/job processing system similar to Celery but based on how Ruby's
    Resque system works.

Caching

A high performance caching system that can act as a drop-in replacement for

Beaker's caching. Unlike Beaker's caching, this utilizes Redis for distributed
write-locking dogpile prevention. It also collects hit/miss cache statistics
along with recording what regions are used by which functions and arguments.

Example:

from retools.cache import CacheRegion, cache_region, invalidate_functionCacheRegion.add_region('short_term', expires=3600)@cache_region('short_term')def slow_function(*search_terms):    # Do a bunch of work    return resultsmy_results = slow_function('bunny')# Invalidate the cache for 'bunny'invalidate_function(slow_function, [], 'bunny')

Differences from Beaker

Unlike Beaker's caching system, this is built strictly for Redis. As such, it

adds several features that Beaker doesn't possess:

  • A distributed write-lock so that only one writer updates the cache at a time
    across a cluster.
  • Hit/Miss cache statistics to give you insight into what caches are less
    effectively utilized (and may need either higher expiration times, or just
    not very worthwhile to cache).
  • Very small, compact code-base with 100% unit test coverage.

Locking

A Redis based lock implemented as a Python context manager, based on .

Example:

from retools.lock import Lockwith Lock('a_key', expires=60, timeout=10):    # do something that should only be done one at a time

转载地址:http://fxkta.baihongyu.com/

你可能感兴趣的文章
python基础学习笔记
查看>>
shell编程
查看>>
MongoDB 主从同步设置
查看>>
百度地图之控件
查看>>
js keycode大全
查看>>
颜色空间系列4: RGB和YDbDr颜色空间的转换及优化算法
查看>>
Unity C# 设计模式(七)适配器模式
查看>>
Lancel sac négociation avec insistance que nous pourrions réaliser de quelle route
查看>>
空白表单提交到后台的数据类型总结(java)
查看>>
Vue问题区
查看>>
[原]Unity3D深入浅出 - Shader基础开发
查看>>
netty之ByteBuf详解
查看>>
数据泵导出oracle 10g数据库
查看>>
LYSE-模块
查看>>
Date Picker和UITool Bar控件简单介绍
查看>>
sql server 实现多表连接查询
查看>>
HTTP 1.1与HTTP 1.0的比较
查看>>
如何在命令行脚本中启动带参数的Windows服务
查看>>
abstract vs interface
查看>>
nodejs笔记1 ----关于express不是本地命令
查看>>