On Thursday, January 16, 2014 10:17:31 AM UTC+1, Arnon Marcus wrote: > > I noticed that the current implementation for web2py uses pickles. > That is a design choice. There are pros and cons. > Right off of my head, the biggest cons may be retricting cache-use to > python, and performance penalties. >
cache doesn't cache only resultsets, hence pickle is the only possible choice. > When I think of all that redis can do, I can not help imagining a better > solution - especially for caching query results. > All result-sets are flat and simple in nature - before the dal steps in > and converts them to row objects. This makes it an ideal candidate for > redis. > Has anyone thought of this already? > A simplistic (naive) solution aould be to store every result in a hash, > and stlre all the ids in a sorted set. This way, the result-sef in the > cache may be queried by redis, and not necessarily be pulled in an > all-or-nothing fasion, improving read-performance and resources > dramatically, while opening the possibilities for external non-python > processes to access the cache talking to redis directly. > It may not be desierable for all use-cases, as there are obviouse security > concearns, but for ipc stuff and/or intranet applications (which are a > common use-case in the web2py world), this can be most beneficial. > What do you say? It's cool. Actually, I started developing something like that using DAL callbacks, but as soon as multiple tables are involved with FK and such, it starts to loose "speed". Also, your whole app needs to be coded a-la "ActiveRecord", i.e. fetch only by PK. BTW, I'm not properly sure that fetching 100 records with 100 calls to redis vs pulling a single time a pickle of 1000 records and discarding what you don't need is faster. BTW2: ORM are already there: redisco and redis-lympid -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.