[Dancer-users] activate cache based on memory usage

Maurice Mengel mauricemengel at gmail.com
Thu Dec 23 20:20:15 CET 2010

Hi Naveed,

thanks for the response!

I was referring to my file cache that I am experimenting with. I have
an xml in SAX which in some circumstances is too big to transform it
in DOM. So I thought I write it on disk and serve it from there with
send_file. (I think that is a recommendation someone gave me in
September when I asked a similar questions... thanks again)

It seems that this can free up to 50% of the memory in my case.

Anyways, i figured out a solution for how to trigger the cache where I
don't need to know the memory. I just count the records that I am

Now, I am playing with send_file and notice that documentation is not
very explicit...


On Thu, Dec 23, 2010 at 11:54 AM, Naveed Massjouni <naveedm9 at gmail.com> wrote:
> On Thu, Dec 23, 2010 at 12:09 PM, Maurice Mengel
> <mauricemengel at gmail.com> wrote:
>> Dear Dancers,
>> i would like to activate my caching mechanism if perl uses more than a
>> certain amount of memory.
>> Two questions
>> 1) is this the right approach or should I look for some other
>> criterion to active cache?
>> 2) How to do it?
>> I looked at
>> - http://perldoc.perl.org/perldebguts.html#Debugging-Perl-memory-usage and
>> - Memory::Usage, but this seems not to work from under Dancer.
>> Thanks!
>> Maurice
> Based on my understanding, the caching mechanism uses memory to cache
> the routes.  So it does not make sense to me to want to turn on the
> cache when your system memory is low.
> -Naveed

More information about the Dancer-users mailing list