[Dbix-class] DBIx::Class::Storage::Replication -- stick to master
flag
John Napiorkowski
jjn1056 at yahoo.com
Tue Jan 5 14:22:30 GMT 2010
>
>From: Bill Moseley <moseley at hank.org>
>To: dbix-class <dbix-class at lists.scsys.co.uk>
>Sent: Sun, January 3, 2010 9:47:42 PM
>Subject: [Dbix-class] DBIx::Class::Storage::Replication -- stick to master flag
>
>>I'm just looking at this module and one thing I'd like to be able to do is tie reads to the master for some period of time for a given id (say an account id) after a write to the master. The goal is to force all reads (from multiple process) from the master for some reasonable period of time to allow the slaves to sync.
>
>In other words, something like this:
>
>1) Pass in an id (via ACCEPT_CONTEXT in Catalyst where the id is stored in the session, say).
>2) For any operation that goes to the master (e.g. transaction or write) set a flag in a cache (in memcached). This flag will be used by subsequent request to read from the master.
>
>Likewise, upon fetching a schema object check for the flag (in the cache) and if set then call set_reliable_storage(). Sure, the flag could be in the session, but the scope may need to be wider than a session at times.
>
>Anyone extended this class to do something like this already? If not, can someone familiar with the module provide some tips on how to accomplish?
>
>Thanks,
>
>
>
>--
>Bill Moseley
>moseley at hank.org
>
Take a look at DBIx::Class::Schema::RestrictWithObject since I think that was written to help with these kinds of trouble, might help. --john
More information about the DBIx-Class
mailing list