Changeset 399

Show
Ignore:
Timestamp:
08/13/07 22:32:05 (2 years ago)
Author:
mpaschal
Message:

Use same keywords as memcached driver
POD

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/Data/ObjectDriver/Driver/Cache/Apache.pm

    r398 r399  
    5353    my $r = $driver->r or return; 
    5454 
    55     $driver->start_query('APACHECACHE_UPDATE ?,?', \@_); 
     55    $driver->start_query('APACHECACHE_SET ?,?', \@_); 
    5656    my $ret = $r->pnotes($_[0], $_[1]); 
    5757    $driver->end_query(undef); 
     
    6565    my $r = $driver->r or return; 
    6666 
    67     $driver->start_query('APACHECACHE_REMOVE ?', \@_); 
     67    $driver->start_query('APACHECACHE_DELETE ?', \@_); 
    6868    my $ret = delete $r->pnotes->{$_[0]}; 
    6969    $driver->end_query(undef); 
     
    7474 
    75751; 
     76 
     77__END__ 
     78 
     79=head1 NAME 
     80 
     81Data::ObjectDriver::Driver::Cache::Apache - object driver for caching objects in Apache's request space 
     82 
     83=head1 SYNOPSIS 
     84 
     85    package MyObject; 
     86    use base qw( Data::ObjectDriver::BaseObject ); 
     87 
     88    __PACKAGE__->install_properties({ 
     89        ... 
     90        driver => Data::ObjectDriver::Driver::Cache::Apache->new( 
     91            fallback => Data::ObjectDriver::Driver::Cache::Memcached->new( 
     92                cache    => Cache::Memcached->new({ servers => \@MEMCACHED_SERVERS }), 
     93                fallback => Data::ObjectDriver::Driver::DBI->new( @$DBI_INFO ), 
     94            ), 
     95        ), 
     96        ... 
     97    }); 
     98 
     99    1; 
     100 
     101=head1 DESCRIPTION 
     102 
     103I<Data::ObjectDriver::Driver::Cache::Apache> provides automatic caching of 
     104retrieved objects in the per-request memory space of your Apache mod_perl 
     105processes, when used in conjunction with your actual object driver. It can be 
     106used to provide even faster results over memcached when requesting objects that 
     107have already been requested during the same request by some other part of your 
     108application, at the cost of the memory necessary to store the objects. 
     109 
     110If your models can be used in an Apache mod_perl application as well as another 
     111context such as a command line shell, consider replacing the Apache layer of 
     112your caching with a C<Data::ObjectDriver::Driver::Cache::RAM> layer when Apache 
     113is not available. See L<Data::ObjectDriver::Driver::Cache::Apache>. 
     114 
     115=head1 USAGE 
     116 
     117=over 4 
     118 
     119=item * Data::ObjectDriver::Driver::Cache::Apache->new(%params) 
     120 
     121Required members of C<%params> are: 
     122 
     123=over 4 
     124 
     125=item * C<fallback> 
     126 
     127The C<Data::ObjectDriver> object driver from which to request objects that are 
     128not found in the Apache process cache. 
     129 
     130=back 
     131 
     132=back 
     133 
     134=head1 DIAGNOSTICS 
     135 
     136The Apache driver provides integration with the C<Data::ObjectDriver> debug and 
     137profiling systems. As these systems are designed around SQL queries, synthetic 
     138queries are logged to represent caching operations. The operations generated by 
     139this driver are: 
     140 
     141=over 4 
     142 
     143=item * C<APACHECACHE_GET ?> 
     144 
     145Retrieve an object. The argument is the cache key for the requested object. 
     146 
     147=item * C<APACHECACHE_ADD ?,?> 
     148 
     149Add an object to the cache. The arguments are the cache key for the object and 
     150the flattened representation of the object to cache. 
     151 
     152=item * C<APACHECACHE_SET ?,?> 
     153 
     154Put an object in the cache. The arguments are the cache key for the object and 
     155the flattened representation of the object to cache. 
     156 
     157=item * C<APACHECACHE_DELETE ?> 
     158 
     159Remove an object from the cache. The argument is the cache key for the object 
     160to invalidate. 
     161 
     162=back 
     163 
     164=head1 SEE ALSO 
     165 
     166=head1 LICENSE 
     167 
     168I<Data::ObjectDriver> is free software; you may redistribute it and/or modify 
     169it under the same terms as Perl itself. 
     170 
     171=head1 AUTHOR & COPYRIGHT 
     172 
     173Except where otherwise noted, I<Data::ObjectDriver> is Copyright 2005-2006 
     174Six Apart, cpan@sixapart.com. All rights reserved. 
     175 
     176=cut