Cache-Static
view release on metacpan or search on metacpan
column level depends "DBI|column|$dsn|$tablename|$columname"
row depends "DBI|row|$dsn|$tablename|$uid_column_name|$uid_value"
NOTE: don't have to do the hard work of figuring out where
the primary key is - let the programmer do that - for two reasons:
- 1: it's non-sensical/unclear to specify a uid_value without
saying where it comes from
- 2: it's hard
how to do row depends:
WORM - it's ok for a write to be expensive. so before exec(), do a
select primary_key_name from table_name where $WHERE_CLAUSE
then update those timestamps.
this implies we need a list of table -> primary key mappings
somewhere (we can try to get fancy and autodetect later)
seperate out prepare()
what about SELECT expressions, etc. that have
side-effects? for now, caveat emptor...
auto-increment just used at row create time (not read time).
actually i think we're ok except for triggers...
also parsing, we need to watch out for compound statements (aka
procedures)
http://dev.mysql.com/doc/refman/5.0/en/stored-procedure-syntax.html
-- it'd be nice to add a config value for a threshold above which
items are compressed, e.g. 250k
-- writing .dep file should be optional, controlled by a config time
option
-- implement a similar store which dumps friendly key name & conf time
option for it
-- HTML_Mason_Util:
- cache component compile stuff for non-top-level depends
find the list of nodes that have changed.
save the tree and just update the children of those nodes
this requires saving a tree structure, not merely an array, to disk
- think about $m->comp() and $m->scomp() (currently unrecognized)
- configurability:
unrecognized_html_mason_dependency_returns => 0
(inherit from unrecognized_dependency_returns)
html_mason_recurse_levels => -1 (unlimited)
(disable with 0, or specify number of times to recurse)
- think about components that have content
... it'd be nice to also depend on the relevant autohandlers too ...
-- cleanup:
- use a TEST namespace for t/*.t in TEST.pm
- _DBI|... vs. DBI|... specs
is there a similar problem with XML_Comma vs. _XML_Comma ?
- permission handling on directories - making them all 777 is probably
not what we want...
-- test suite
finish tests:
test namespace overrides and init(), rebase(), etc. behavior
dbi tests should try to create db/table if they don't exist...
? dbi tests should look for a config file (from previous install) ?
html-mason-util.t (use HTML::Mason::Tests, hmc)
xml-comma-util.t
misc.t (_log... makekey, md5path, etc... misc from Static.pm)
-- read old/write asynchronous option
-- cleanup:
extension/wrapper thing could be cleaner
change way extensions work -> if possible, translate to a file
dependency, instead of checking the dependency in the extension.
this allows for scache to work on extensions
-- documentation:
null $deps in set()... two usage modes, one where we care,
one where we don't. be more explicit about this...
this is not even the tip of the iceberg...
---- STUFF FOR LATER ----
-- the one second wait bug:
you have to wait one second or else you will always regenerate
this is a limitation of stat() and/or what's stored in most filesystems
solution:
- if $have_fcntl, lock writes to lessen dependency expiration bursts
(only regen once)
since we have a WORM model, writes can be expensive. therefore,
- when you call set, also save a file called $cachefile.microseconds
- if timestamps are equal, THEN read $cachefile.microseconds.
use this to determine if we need a refresh or not
to do this we require Time::HiRes, but that's ok b/c this whole
functionality will be optional
-- binary dependency lists, eg.
( "file|/die/young" AND "file|/leave/a/beautiful/corpse" )
OR ( "file|/get/old" AND "file|/get/fat" AND "file|/get/ugly" )
-- tools for manually purging groups of stuff from the cache...
e.g.
/items/200512140010?doc=mm_item|post|200512140010&offset=&per_page=20
a/0/Q/0lMqP_p04cdaaBZK2Dw
This will require having a list of MD5->orig names somewhere.
-- cache expiration/replacement policies:
we want to cache "forever" - but in reality, pages will go away, etc.
we should have a default timeout of say a week...
cronjob cleanups?
-- perhaps make _Cache_Static_hmc a restricted namespace but allow
writes to it with !_Cache_Static_hmc ?
-- XML_Comma_Util:
it'd be nice to have an automagic depend on the def file
... but gettihg thru comma is too slow (0.02 sec on p4, 3GHz)...
this would require a caching scheme...
0) check in a hash in memory
1) check in /usr/local/Cache-Static/ext/XML_Comma/$defname
(whose contents will be just a .def file)
2) do the expensive lookup
( run in 1.585 second using v1.01-cache-2.11-cpan-39bf76dae61 )