FAQ
Hi,

I'm trying to find out how to implement caching on a site, preferrably
with Cache::FastMmap, but I'm open to suggestions. I'm not including my
trial source now, since I'm unsure I have read the correct documentation.

Alex


--
Alexander Tamm
Developer
FRANTIC | http://www.frantic.com

alex@frantic.com
+358-40-532 7177

Search Discussions

  • Jay Shirley at Apr 14, 2009 at 9:47 pm

    On Wed, Apr 15, 2009 at 1:11 AM, Alexander Tamm wrote:

    Hi,

    I'm trying to find out how to implement caching on a site, preferrably with
    Cache::FastMmap, but I'm open to suggestions. I'm not including my trial
    source now, since I'm unsure I have read the correct documentation.

    Alex


    --
    Alexander Tamm
    Developer
    FRANTIC | http://www.frantic.com

    alex@frantic.com
    +358-40-532 7177

    Catalyst::Plugin::PageCache?
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090415/add60499/attachment.htm
  • Alexander Tamm at Apr 15, 2009 at 6:23 am

    J. Shirley wrote:
    I'm trying to find out how to implement caching on a site,
    preferrably with Cache::FastMmap, but I'm open to suggestions. I'm
    not including my trial source now, since I'm unsure I have read the
    correct documentation.
    Catalyst::Plugin::PageCache?
    Thanks, but I want to cache values that are the result of expensive
    database queries, preferrably a a hash reference.

    Alex

    --
    Alexander Tamm
    Developer
    FRANTIC | http://www.frantic.com

    alex@frantic.com
  • Tomas Doran at Apr 15, 2009 at 8:50 pm

    On 15 Apr 2009, at 07:23, Alexander Tamm wrote:

    J. Shirley wrote:
    I'm trying to find out how to implement caching on a site,
    preferrably with Cache::FastMmap, but I'm open to suggestions.
    I'm
    not including my trial source now, since I'm unsure I have
    read the
    correct documentation.
    Catalyst::Plugin::PageCache?
    Thanks, but I want to cache values that are the result of expensive
    database queries, preferrably a a hash reference.
    Take a look at Catalyst::Plugin::Cache. The docs are a bit crap
    (patches welcome!), but it'll do what you want, and has nice features
    to give you curried accessors for things etc..

    I'd personally combine that with Cache::Memcached, but you can use
    whatever Cache:: backend you want.

    Cheers
    t0m
  • Peter Edwards at Apr 15, 2009 at 10:22 pm
    2009/4/15 Tomas Doran <bobtfish@bobtfish.net>
    On 15 Apr 2009, at 07:23, Alexander Tamm wrote:

    J. Shirley wrote:
    I'm trying to find out how to implement caching on a site,
    preferrably with Cache::FastMmap, but I'm open to suggestions. I'm
    not including my trial source now, since I'm unsure I have read the
    correct documentation.
    Catalyst::Plugin::PageCache?
    Thanks, but I want to cache values that are the result of expensive
    database queries, preferrably a a hash reference.
    Take a look at Catalyst::Plugin::Cache. The docs are a bit crap (patches
    welcome!), but it'll do what you want, and has nice features to give you
    curried accessors for things etc..

    I'd personally combine that with Cache::Memcached, but you can use whatever
    Cache:: backend you want.

    Cheers
    t0m
    For sure, use memcached. You should also try and cache everywhere, at the db
    access level, at the business object level, page fragments and also pages.
    There are some good papers here: http://highscalability.com/tags/memcached

    Regards, Peter
    http://perl.dragonstaff.co.uk
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090415/d86f7bcd/attachment.htm
  • Alexander Tamm at Apr 16, 2009 at 6:32 am

    Tomas Doran wrote:

    Take a look at Catalyst::Plugin::Cache. The docs are a bit crap (patches
    welcome!), but it'll do what you want, and has nice features to give you
    curried accessors for things etc..
    Well, that's just it... I've read the docs and tried to configure it,
    but I never get a cache hit.

    I've tried this:

    in MyApp.pm:
    __PACKAGE__->config(
    # other stuff.
    'Plugin::Cache' => {
    'backend' => {
    store => 'FastMmap',
    },
    },
    );
    ...but the return value of $c->cache->get->($key) is always undef,
    although I make sure to always $c->cache->set( $key, $value)

    So I'm pretty sure I've missed something.

    Alex

    --
    Alexander Tamm
    Developer
    FRANTIC | http://www.frantic.com

    alex@frantic.com
  • Tomas Doran at Apr 16, 2009 at 7:38 am

    On 16 Apr 2009, at 07:32, Alexander Tamm wrote:

    Tomas Doran wrote:
    Take a look at Catalyst::Plugin::Cache. The docs are a bit crap
    (patches welcome!), but it'll do what you want, and has nice
    features to give you curried accessors for things etc..
    Well, that's just it... I've read the docs and tried to configure
    it, but I never get a cache hit.

    I've tried this:

    in MyApp.pm:
    __PACKAGE__->config(
    # other stuff.
    'Plugin::Cache' => {
    'backend' => {
    store => 'FastMmap',
    },
    },
    );
    ...but the return value of $c->cache->get->($key) is always undef,
    although I make sure to always $c->cache->set( $key, $value)

    So I'm pretty sure I've missed something.
    Are you using version >= 0.07? The config key changed, and you're
    using the new key, which will be ignored if your plugin isn't recent
    enough.

    Also, I really recommend you switch to memcache, as (1) it had great
    debugging you can just turn on, (2) in the worst case, you can pull
    out wireshark, (3) its cache eviction policies are generally more
    sane and understandable than fastmmap, (4) you can get useful stats
    like the hit rate out of it..

    Cheers
    t0m
  • Graeme Lawton at Apr 16, 2009 at 7:54 am
    Also Catalyst::Plugin::Cache::Store::FastMmap is now deprecated as you
    can use it without store, and should see a slight performance
    improvement.

    Graeme


    2009/4/16 Tomas Doran <bobtfish@bobtfish.net>:
    On 16 Apr 2009, at 07:32, Alexander Tamm wrote:

    Tomas Doran wrote:
    Take a look at Catalyst::Plugin::Cache. The docs are a bit crap (patches
    welcome!), but it'll do what you want, and has nice features to give you
    curried accessors for things etc..
    Well, that's just it... I've read the docs and tried to configure it, but
    I never get a cache hit.

    I've tried this:

    in MyApp.pm:
    __PACKAGE__->config(
    ? ? ? ? ? ? ? ? ? ?# other stuff.
    ? ? ? ? ? ? ? ? ? ?'Plugin::Cache' => {
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'backend' => {
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? store => 'FastMmap',
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?},
    ? ? ? ? ? ? ? ? ? ? },
    ? ? ? ? ? ? ? ?);
    ...but the return value of $c->cache->get->($key) is always undef,
    although I make sure to always $c->cache->set( $key, $value)

    So I'm pretty sure I've missed something.
    Are you using version >= 0.07? The config key changed, and you're using the
    new key, which will be ignored if your plugin isn't recent enough.

    Also, I really recommend you switch to memcache, as (1) it had great
    debugging you can just turn on, (2) in the worst case, you can pull out
    wireshark, (3) its cache eviction policies are generally more sane and
    understandable than fastmmap, (4) you can get useful stats like the hit rate
    out of it..

    Cheers
    t0m



    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
  • Tomas Doran at Apr 16, 2009 at 8:30 am

    On 16 Apr 2009, at 08:54, Graeme Lawton wrote:

    Also Catalyst::Plugin::Cache::Store::FastMmap is now deprecated as you
    can use it without store, and should see a slight performance
    improvement.
    Erm, the configuration which was shown doesn't use
    C::P::Cache::Store::FastMMap.

    Also, I guess it wasn't deprecated due to the fact that using it
    directly gives a slight performance improvement (as if you care or
    need to care about such minutae, you're doing it wrong), but more due
    to the fact that it is in no way generic (supporting only FastMMap).

    Cheers
    t0m
  • Peter Karman at Apr 16, 2009 at 2:12 pm

    Alexander Tamm wrote on 04/16/2009 01:32 AM:
    Tomas Doran wrote:
    Take a look at Catalyst::Plugin::Cache. The docs are a bit crap
    (patches welcome!), but it'll do what you want, and has nice features
    to give you curried accessors for things etc..
    Well, that's just it... I've read the docs and tried to configure it,
    but I never get a cache hit.

    I've tried this:

    in MyApp.pm:
    __PACKAGE__->config(
    # other stuff.
    'Plugin::Cache' => {
    'backend' => {
    store => 'FastMmap',
    },
    },
    );
    ...but the return value of $c->cache->get->($key) is always undef,
    although I make sure to always $c->cache->set( $key, $value)
    I had the same experience and just switched to the File cache plugin
    instead.

    --
    Peter Karman . peter@peknet.com . http://peknet.com/
  • Jonathan Rockway at Apr 23, 2009 at 8:14 pm

    * On Thu, Apr 16 2009, Peter Karman wrote:
    I had the same experience and just switched to the File cache plugin
    instead.
    Are you storing big things, i.e. pieces of data bigger than the cache
    "pages"? If so, fastmmap will silently not store those pieces of data.

    In general, I find it very flaky, and would recommend something else.

    --
    print just => another => perl => hacker => if $,=$"
  • Octavian Rasnita at Apr 23, 2009 at 8:38 pm
    From: "Jonathan Rockway" <jon@jrock.us>
    * On Thu, Apr 16 2009, Peter Karman wrote:
    I had the same experience and just switched to the File cache plugin
    instead.
    Are you storing big things, i.e. pieces of data bigger than the cache
    "pages"? If so, fastmmap will silently not store those pieces of data.

    In general, I find it very flaky, and would recommend something else.
    From the portability perspective, I think that Cache::FileCache should be
    always prefered in order to allow installing some apps or cpan modules under
    Windows also.
    If somebody installs a certain app or perl module under Unix and want a
    better cache, I think it would be very simple to change it with a better
    caching system so it won't be a big issue.

    I tried to install some cpan modules like MojoMojo and AngerWhale under
    Windows in order to test them, but with no success until now...

    Octavian
  • Oliver Charles at Apr 15, 2009 at 1:30 am

    On Tue, Apr 14, 2009 at 5:11 PM, Alexander Tamm wrote:
    Hi,

    I'm trying to find out how to implement caching on a site
    This has been covered quite a bit in the Catalyst advent calendar
    articles, maybe these will help:

    http://catalyst.perl.org/calendar/2007/11
    http://www.catalystframework.org/calendar/2008/14

    --
    Oliver Charles / aCiD2
  • Alexander Tamm at Apr 15, 2009 at 6:25 am

    Oliver Charles wrote:
    On Tue, Apr 14, 2009 at 5:11 PM, Alexander Tamm wrote:
    Hi,

    I'm trying to find out how to implement caching on a site
    This has been covered quite a bit in the Catalyst advent calendar
    articles, maybe these will help:

    http://catalyst.perl.org/calendar/2007/11
    http://www.catalystframework.org/calendar/2008/14
    Thanks, but I should have specified that I want to cache values in the
    application itself. I already have an implementation for controlling the
    browsers cache.

    Alex


    --
    Alexander Tamm
    Developer
    FRANTIC | http://www.frantic.com

    alex@frantic.com
  • Oliver Charles at Apr 15, 2009 at 11:07 am

    On Wed, Apr 15, 2009 at 7:25 AM, Alexander Tamm wrote:
    Thanks, but I should have specified that I want to cache values in the
    application itself. I already have an implementation for controlling the
    browsers cache.
    This is less of a Catalyst question then I guess? You could make use
    of caching in your back end models (which are independent of Catalyst,
    right!?) with the Cache:: modules, and if you need some Catalyst
    integration, then you could use Catalyst::Plugin::Cache.

    --
    Oliver Charles / aCiD2

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedApr 14, '09 at 4:11p
activeApr 23, '09 at 8:38p
posts15
users9
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase