didip / beaker_extensions Goto Github PK
View Code? Open in Web Editor NEWExtending beaker (cache & session module) to use No SQL backend.
License: MIT License
Extending beaker (cache & session module) to use No SQL backend.
License: MIT License
Current NoSqlManager.get_creation_lock
doesn't take into account key
, which leads to deadlocks in some situations. A possible fixture is:
def get_creation_lock(self, key):
return file_synchronizer(
identifier ="tccontainer/funclock/%s/%s" % (self.namespace, key),
lock_dir = self.lock_dir)
Can you please specify a software license for this project? Otherwise, I don't think people can use this software. See Jeff Atwood's post: http://www.codinghorror.com/blog/2007/04/pick-a-license-any-license.html
so there is this bit in redis_.py
def _format_key(self, key):
return 'beaker:%s:%s' % (self.namespace, key.replace(' ', '\302\267'))
That generates a key like this:
beaker:f1d17960690c49a9807e5b4c2e29afd3:session
but one might expect
beaker:session:f1d17960690c49a9807e5b4c2e29afd3
If this was intended, there should be a note to let people know how/where to look for their data.
contains in the redis method appears to format the key twice, so when beaker tries to look up something that should have been:
beaker:AutoJunction:Advert:AdvertMastShort:23
it asks for:
beaker:AutoJunction:Advert:beaker:AutoJunction:Advert:AdvertMastShort:23
which results in a cache miss.
I'm not sure how to submit a patch, but the fix appears to be pretty easy.
Change:
def __contains__(self, key):
key = self._format_key(key)
return self.db_conn.exists(self._format_key(key))
to:
def __contains__(self, key):
return self.db_conn.exists(self._format_key(key))
which is actually how all the other extensions seem to do it anyway.
The latest version on pypi is 0.1.1dev. Please update pypi with the latest. If not maintaining pypi, then remove it so no one is confused about the old version.
Also can you create tags for every version? If we must use git for latest version, then we need a way to pin to that specific version for our deployment.
Hi,
If i do not specify a connection pool, then connections are leaked continuously until you hit the max open files limit, at which point redis uses 100% of cpu and silently fails unless debug is set. The latest version of redis has fixed the silent nature of the failure.
testing with ab -n 1000 -c 10 the connection count climbs and doesn't fall until they time out.
netstat -tn|grep 6379|wc -l
6008
netstat -tn|grep 6379|wc -l
8009
if i specify a pool:
def setup_redis_session(app):
redis_pool = redis.ConnectionPool(host='localhost', port=6379, db=0)
return SessionMiddleware(app, type="redis", url="localhost:6379", key="musicfilmcomedy", connection_pool=redis_pool)
after many requests:
netstat -tn|grep 6379|wc -l
10
netstat -tn|grep 6379|wc -l
13
netstat -tn|grep 6379|wc -l
8
I tested with uwsgi and cherrypy. I'm using the latest git code.
Looks like keys() are implemented, but should it return value in normal way instead of raising generic exception based on it?
https://github.com/didip/beaker_extensions/blob/master/beaker_extensions/redis_.py#L42
def keys(self):
raise self.db_conn.keys('beaker:%s:*' % self.namespace)
I've got this running for python 3.3. The only changes I had to make were in ringogw.py, changing one except a,b to except a as b, and two prints.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.