[Dbix-class] Caching DBIx-Class Fixtures

Ovid publiustemp-dbic at yahoo.com
Wed Jun 18 11:38:28 BST 2008


Hi all,

Pursuant to an idea I've outlined in
http://use.perl.org/~Ovid/journal/36711, we're looking at caching some
of our test fixtures.  While some might *require* being generated
dynamically, many of our fixtures are in the following form:

  get bbc4 id
  create brand on bbc4
  create series3 on brand
  create episode2 on series3
  create 2 versions of episode2
  create episode3 on series3

And so on.  In short, these are large fixture files with very static
data being added to the database.  We feel that we can gain some
significant benefits if we can cache the above in something like this:

  -- md5:  ab523604f2f588df05389958560a042a

  INSERT INTO brand ...

  INSERT INTO series ...

And so on.  The idea is that on the first run of a fixture, we'd run
the code and cache the sql.  On subsequent runs, if the md5 of the file
hasn't changed, we'd just send the cached SQL directly to MySQL rather
than run the code.

I think this would require intercepting the SQL and bind parameters and
every fixture would have a file we'd cache this in.  Has anyone tried
anything like this before?  How the heck would I get the SQL and bind
params for something like?

Or is there a much easier way of going about this?

Cheers,
Ovid

--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/



More information about the DBIx-Class mailing list