I made a workaround to reset cache (per session for now).
I have array, where I mark keys to be reset, and afer reset they can
be removed or marked as done.

def caching_time_get(key, caching_time=60*60*24):
    """
    function to handle caching resets
    when the reset is on,
    it returns 0 once -- so the cache should expire
    and then it goes on standart expiries
    """
    if key in session.cache_invalidate and
session.cache_invalidate[key]:
        return 0
    else:
        return caching_time

then I do:
@cache( the_key, time_expire=caching_time_get( the_key ),
cache_model=cache.ram  )
def some_controller():
   return sth_time_greedy()


and if I need to refresh cached stuff, I do:
session.cache_invalidate[the_key]=True

On 22 sept., 13:18, Jurgis Pralgauskis <jurgis.pralgaus...@gmail.com>
wrote:
> but as I understand GAE supports only memcache, and no cache.ram or
> cache.diskhttp://www.web2py.com/book/default/chapter/11#Avoid-the-Filesystem
>
> "Memcache"
> on GAE cache.ram and cache.disk should not be used, so we make them
> point to cache.memcache.
>
> ps.: there are two Memcache anchors in this page (general Memcache and
> GAE Memcache)
> so I direct by other GAE subtopic ;)
>
> On 20 Rugs, 16:36, Scott <blueseas...@gmail.com> wrote:
>
> > If you are interested in caching view or controller output, please
> > check the examples 
> > section:http://web2py.com/examples/default/examples#cache_examples
>
> > Notice the timers which indicate how long before the view or
> > controller output is re-rendered.  You can also check out appadmin.py
> > included within your application; it shows you how to clear cached
> > output, e.g.:
>
> >         if clear_ram:
> >             cache.ram.clear()
> >             session.flash += "Ram Cleared "
> >         if clear_disk:
> >             cache.disk.clear()
> >             session.flash += "Disk Cleared"
>
> > On Sep 18, 6:45 pm,JurgisPralgauskis <jurgis.pralgaus...@gmail.com>
> > wrote:
>
> > > would it be sound to use some cache_db instead of memcache in GAE
> > > then?
> > > For example if I render a CPU requiring view I want to cache,
> > > but  I could clear it anytime I like.
>
> > > hm, or could there be a recipy to abandon current memcached object.
> > > this would need extra hash table:
>
> > > as if now probably is sth like
> > > stuff_key <---cached---> stuff_value
>
> > > would become
> > > stuff_key <---extra_hash---> stuff_key_timestamp <---cached--->
> > > stuff_value
> > > and on clear just delete the stuff_key from extra_hash
>
> > > On 2 Rugs, 00:25, mdipierro <mdipie...@cs.depaul.edu> wrote:> no. sorry
>
> > > > On Sep 1, 3:49 pm,JurgisPralgauskis <jurgis.pralgaus...@gmail.com>
> > > > wrote:
>
> > > > > Hello,
>
> > > > > inhttp://www.web2py.com/book/default/chapter/04booksays
>
> > > > > The time_expire can be set to 0 to force a cache refresh and to None
> > > > > to prevent the content from ever expiring.
> > > > > You can clear one or more cache variables with
> > > > > cache.ram.clear(regex='...')
>
> > > > > does this apply to gaememcache?
>
> > > > > ifmemcachedecorates some controller,
> > > > > and I know its key, how can I force recache its new result?- Slëpti 
> > > > > cituojamà tekstà -
>
> > - Rodyti cituojamà tekstà -
>
>

Reply via email to