[Dbix-class] Caching solutions for DBIx::Class

Jorge Gonzalez jorge.gonzalez at daikon.es
Mon Jul 4 17:25:10 GMT 2011


I can't check it out now, but my best bet would be the following:

a) do as I told in my prior email, so you specify caching strategy for  
most of your tables with almost no effort.

b) for the tables wich you want to have a different caching policy,  
modify the resultset_attributes parameter for that class in the Schema  
class configuration (in the file part which is not rewritten when  
regenerating the schema).

Please try :-)
J.

El 04/07/11, Fernan Aguero <fernan.aguero at gmail.com> escribió:

> Hola Jorge,
>
> first of all many thanks for sharing your tips.
>
> On Mon, Jul 4, 2011 at 10:46 AM, Jorge Gonzalez
> <jorge.gonzalez at daikon.es> wrote:
>>
>> This is the full configuration for my model, which includes heavy  
>> caching (it's a readonly access to a data warehouse which gets  
>> updated once a day):
>>
>> Model::MyDB:
>>   traits:
>>     - Caching
>>     - SchemaProxy
>>   default_resultset_attributes:
>>     cache_for: 3600    # cache results for one our
>>   connect_info:
>>     dsn: 'dbd:mysql:host=1.2.3.4;database=test'
>>     user: test
>>     password: test
>
> [snipped]
>
>
>> With this configuration I didn't have to touch a single line where  
>> queries were being executed.
>
> [snipped]
>
>> Regards
>> J.
>
> I have one question, though: I have a number of essentially static
> tables (very infrequent changes), and some tables that change a lot
> during a session (e.g. those that store data from the user's session,
> for persistency across logins).
>
> Is there a way to exclude specific tables from the caching?
>
> I've read the docs and I see I can specify the caching (yes/no, TTL)
> for every query being executed ...
>
> The problem is that i) I don't want to do this (I prefer your
> suggestion to turn on caching for all queriesI; and ii) the queries
> for which I'd like to turn off caching are not executed by me, but by
> the corresponding plugins (e.g. Session::Store::DBIC;
> Session::PerUser).
>
> Anyone has solved this? Suggestions welcome.
>
> --
> fernan
>






More information about the DBIx-Class mailing list