I was wondering if DAL level caching could be added. I am aware of
cache.ram and cache.disk, but these require the usage of a decorator
over the functions. I feel that a cache option to cache at the DAL level
that could be enabled by flipping an option in db.py of an application
would be of great help. The cache can be a key value pair of sorts,
where the cache is flushed on each write/update and cached on the first
read - There are probably smarter ways of doing this.
Thoughts?
--
Praneeth
values=db(...).select(cache=(cache.disk,3600))
3600 is the time.
Thoughts?
--
Praneeth
db(...).select(cache=(cache.disk,0))
Massimo
cache.ram.clear(type="SQL") and it will only clear the sql typed
entries, leaving other aspects of the cache alone.
however cache.ram.clear() will still clear everything.
That way, the DAL could be set a flag to clear its own cache upon
i/u/d operations.
How does this sound? If good I can start on the patch right away :)
-Thadeus
> --
> You received this message because you are subscribed to the Google Groups "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to web2py+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
>
>
cache.ram.clear(db._uri + '/SELECT')
and it will clear all cached select statements. You have to specify
db._uri because you may have multiple db cached.
Massimo
On Mar 9, 10:37 am, Thadeus Burgess <thade...@thadeusb.com> wrote:
> What if the cache system includes a "category" or "type" field. All
> cached SQL could be of type "SQL", and then say responses can be
> cached as "RESP". This way if you refresh the cache instead of
> clearing the entire thing, we can specify
>
> cache.ram.clear(type="SQL") and it will only clear the sql typed
> entries, leaving other aspects of the cache alone.
>
> however cache.ram.clear() will still clear everything.
>
> That way, the DAL could be set a flag to clear its own cache upon
> i/u/d operations.
>
> How does this sound? If good I can start on the patch right away :)
>
> -Thadeus
>
auto_cache does an infinity cache time, where if there is any updates
done to the db all cached selects are cleared.... and alternatively an
option to only clear cached selects that have to do with the table
that is selected.
I feel about 50% on the idea... not sure I want every single select I
make automatically cached, you definitely wouldn't want this if your
competing for RAM, but if you can afford the RAM this would be nice.
-Thadeus
How does the cache decide how much RAM to use?
On Mar 10, 4:20 am, Thadeus Burgess <thade...@thadeusb.com> wrote:
> So an option to DAL.__init__(auto_cache=False, clear_cache_on_update=False) ?
>
> auto_cache does an infinity cache time, where if there is any updates
> done to the db all cached selects are cleared.... and alternatively an
> option to only clear cached selects that have to do with the table
> that is selected.
>
> I feel about 50% on the idea... not sure I want every single select I
> make automatically cached, you definitely wouldn't want this if your
> competing for RAM, but if you can afford the RAM this would be nice.
>
> -Thadeus
>
--
Kuba
If the server goes down the data is lost.
Web2py already provides this functionality. You can simply do
db=DAL('sqlite:memory:')
Yet is id different from caching.
I think what you want instead if mount the rambased disk as the cache
folder and then do
db(...).select(cache=(ram.disk,3600)....)
so the ram.disk is actually in ram but buffered on disk.
Massimo
On Mar 11, 2:58 am, Kuba Kucharski <kuba.kuchar...@gmail.com> wrote:
-Thadeus
On Mar 11, 9:34 am, Thadeus Burgess <thade...@thadeusb.com> wrote:
> Too bad we can specify to cache.disk where we want it to store...
>
> -Thadeus
>
Thx, Massimo, this is exactly what I was trying to say.. I didn't know about 'memory:' when writing my entry, so I will try to edit this alterego, I tried to cover both cases in alterego and in my reply to this thread I was pointing only one of them, that is where confusion came from
On 11 Mar 2010 17:12, "mdipierro" <mdip...@cs.depaul.edu> wrote:
posting to trunk
On Mar 11, 9:34 am, Thadeus Burgess <thade...@thadeusb.com> wrote:
> Too bad we can specify to cach...
> On Thu, Mar 11, 2010 at 9:14 AM, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > On a second read. ...
> > For more options, visit this group athttp://groups.google.com/group/web2py?hl=en.
--
You received this message because you are subscribed to the Google Groups "web2py-users" group....
from gluon.cache import CacheOnDisk
cache.disk = CacheOnDisk(folder='/the/memory/mapped/folder')
On Mar 11, 11:06 am, Kuba Kucharski <kuba.kuchar...@gmail.com> wrote:
> Thx, Massimo, this is exactly what I was trying to say.. I didn't know about
> 'memory:' when writing my entry, so I will try to edit this alterego, I
> tried to cover both cases in alterego and in my reply to this thread I was
> pointing only one of them, that is where confusion came from
>
Neat.
On 11 Mar 2010 18:13, "mdipierro" <mdip...@cs.depaul.edu> wrote:
Anyway, in trunk you can do
from gluon.cache import CacheOnDisk
cache.disk = CacheOnDisk(folder='/the/memory/mapped/folder')
On Mar 11, 11:06 am, Kuba Kucharski <kuba.kuchar...@gmail.com> wrote:
> Thx, Massimo, this is exa...
> On 11 Mar 2010 17:12, "mdipierro" <mdipie...@cs.depaul.edu> wrote:
>
> posting to trunk
>
> On Mar...
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send e...
--
Kuba
On Mar 11, 12:38 pm, Kuba Kucharski <kuba.kuchar...@gmail.com> wrote:
> How do I get my security code for editing an alterego?
>
> --
> Kuba
>
> On Thu, Mar 11, 2010 at 6:33 PM, Kuba Kucharski
>
> <kuba.kuchar...@gmail.com> wrote:
> > Neat.
http://www.web2pyslices.com/main/slices/take_slice/73
--
Kuba
> --
> You received this message because you are subscribed to the Google Groups "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to web2py+un...@googlegroups.com.
On Mar 11, 2:19 pm, Kuba Kucharski <kuba.kuchar...@gmail.com> wrote:
> I had edited AlterEgo though slices are so much better nowadays
>
> http://www.web2pyslices.com/main/slices/take_slice/73
>
> --
> Kuba
>