[Catalyst] FileCache and PageCache for same app on different ports

Andy Grundman andy at hybridized.org
Wed Jan 4 15:57:09 CET 2006


Richard Jolly wrote:
> Hi,
> 
> We have multiple developers running the same application on different
> ports. 
> 
> Since they share the same cache (FileCache defaults to /tmp/FileCache),
> and the port isn't part of the cache key
> (&PageCache::_get_page_cache_key), we are getting cached pages served
> incorrectly.

I'll fix and release a new version of PageCache that creates a more unique key.

> Ideally I'd like to specify the port as part of the cache storage
> location:
> 
>   package MyApp;
> 
>   use Catalyst qw/Cache::FileCache PageCache/;
> 
>   # make sure caches for apps running on different ports do not conflict
>   __PACKAGE__->config->{cache}->{storage} = "tmp/FileCache/$PORT";
> 
> Is this the right way to do it? 

Right, you can also do this, but PageCache's key should still be more unique.

> And how can I get the port variable here? Its passed down to
> Catalyst::Engine::*, but I don't see any accessors.

The port can be found in $c->req->uri->port.

-Andy



More information about the Catalyst mailing list