Skip Menu |
 

This queue is for tickets about the CHI CPAN distribution.

Report information
The Basics
Id: 71872
Status: resolved
Priority: 0/
Queue: CHI

People
Owner: Nobody in particular
Requestors: njh [...] bandsman.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.49
Fixed in: (no value)



Subject: What does expires mean?
Download (untitled) / with headers
text/plain 375b
Does the expires parameter to "set" mean after now, or after the last access? I want each successful "get" to refresh that cache item so that it expires after a time after the last successful retrieval, not after a set time after now. Please clarify the documentation, and add options to separate the two scenarios, e.g. '1 month after creation' and '1 month after access'.
Subject: Re: [rt.cpan.org #71872] What does expires mean?
Date: Tue, 25 Oct 2011 15:52:18 -0700
To: bug-CHI [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
Download (untitled) / with headers
text/plain 1.2k
It means from when it was set. I've clarified the docs for the next release. Just curious, what's the application for refreshing the cache item every time it is retrieved? Wouldn't that lead to arbitrarily out-of-date cache items if there was a constant trickle of retrievals? You could create a role to do this pretty easily. But it would essentially do a write to the cache every single time it did a read, which is pretty bad performance-wise (unless it's a memory cache or something). Jon On Oct 23, 2011, at 9:17 AM, njh@bandsman.co.uk via RT wrote: Show quoted text
> Sun Oct 23 12:17:04 2011: Request 71872 was acted upon. > Transaction: Ticket created by njh@bandsman.co.uk > Queue: CHI > Subject: What does expires mean? > Broken in: 0.49 > Severity: Normal > Owner: Nobody > Requestors: njh@bandsman.co.uk > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=71872 > > > > Does the expires parameter to "set" mean after now, or after the last > access? I want each successful "get" to refresh that cache item so that > it expires after a time after the last successful retrieval, not after a > set time after now. > > Please clarify the documentation, and add options to separate the two > scenarios, e.g. '1 month after creation' and '1 month after access'.
From: njh [...] bandsman.co.uk
Download (untitled) / with headers
text/plain 526b
On Tue Oct 25 18:52:28 2011, swartz@pobox.com wrote: Show quoted text
> It means from when it was set. I've clarified the docs for the next > release.
Thanks for the clarification. Show quoted text
> > Just curious, what's the application for refreshing the cache item > every time it is retrieved? Wouldn't that lead to arbitrarily out- > of-date cache items if there was a constant trickle of retrievals?
I have a number of places where I'd want to retain popular items which hit often, and discard those that match rarely or not at all. -Nigel
Subject: Re: [rt.cpan.org #71872] What does expires mean?
Date: Sun, 6 Nov 2011 20:45:42 -0800
To: bug-CHI [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
On Oct 26, 2011, at 9:49 AM, njh@bandsman.co.uk via RT wrote: Show quoted text
> Queue: CHI > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=71872 > > > On Tue Oct 25 18:52:28 2011, swartz@pobox.com wrote:
>> It means from when it was set. I've clarified the docs for the next >> release.
> > Thanks for the clarification.
>> >> Just curious, what's the application for refreshing the cache item >> every time it is retrieved? Wouldn't that lead to arbitrarily out- >> of-date cache items if there was a constant trickle of retrievals?
> > I have a number of places where I'd want to retain popular items which > hit often, and discard those that match rarely or not at all.
Ok, in that case you're talking about a size-aware cache with an LRU or similar discard strategy - see http://search.cpan.org/perldoc?CHI#SIZE_AWARENESS However, to be honest, this isn't CHI's strength, as implementing LRU efficiently requires close integration with the backend. Not sure what backend you are using, but Memcached and Cache::FastMmap (for example) both have their own LRU discard implementations. Jon
From: njh [...] bandsman.co.uk
Download (untitled) / with headers
text/plain 610b
Show quoted text
> Ok, in that case you're talking about a size-aware cache with an LRU > or similar discard strategy - see > > http://search.cpan.org/perldoc?CHI#SIZE_AWARENESS
Thanks for the pointer - I'll have a read. Show quoted text
> > However, to be honest, this isn't CHI's strength, as implementing LRU > efficiently requires close integration with the backend. Not sure > what backend you are using, but Memcached and Cache::FastMmap (for > example) both have their own LRU discard implementations.
I'm using File in a webserver application to cache information from queries (for example see CGI::Buffer). -Nigel
From: njh [...] bandsman.co.uk
Download (untitled) / with headers
text/plain 103b
Thinking more about it, you are quite correct, I'm after using LRU but with the File driver not Memory.
Subject: Re: [rt.cpan.org #71872] What does expires mean?
Date: Mon, 7 Nov 2011 08:40:33 -0800
To: bug-CHI [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
Download (untitled) / with headers
text/plain 580b
Yes, the trouble with implementing LRU with the File driver is that you need a centralized place to store all the keys and their last accessed times. If you think of a clever way to implement it, though, I'd be happy to see it. :) Assuming you're not on NFS, you might consider FastMmap, which does implement LRU. Jon On Nov 7, 2011, at 6:42 AM, njh@bandsman.co.uk via RT wrote: Show quoted text
> Queue: CHI > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=71872 > > > Thinking more about it, you are quite correct, I'm after using LRU but > with the File driver not Memory.
From: njh [...] bandsman.co.uk
Download (untitled) / with headers
text/plain 205b
Show quoted text
> Assuming you're not on NFS, you might consider FastMmap, which does > implement LRU.
Is CHI::Driver::FastMmap persistent? I guess it is, but it's not mentioned in the documentation. Rgds, -Nigel
Subject: Re: [rt.cpan.org #71872] What does expires mean?
Date: Mon, 7 Nov 2011 13:02:13 -0800
To: bug-CHI [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
Download (untitled) / with headers
text/plain 467b
Definitely persistent. Perhaps the "shared memory" mention is misleading, I'll fix that. On Nov 7, 2011, at 12:56 PM, njh@bandsman.co.uk via RT wrote: Show quoted text
> Queue: CHI > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=71872 > > >
>> Assuming you're not on NFS, you might consider FastMmap, which does >> implement LRU.
> > Is CHI::Driver::FastMmap persistent? I guess it is, but it's not > mentioned in the documentation. > > Rgds, > > -Nigel >
fixed description of Cache::FastMmap


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.