| | 76 | |
| | 77 | __END__ |
| | 78 | |
| | 79 | =head1 NAME |
| | 80 | |
| | 81 | Data::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 | |
| | 103 | I<Data::ObjectDriver::Driver::Cache::Apache> provides automatic caching of |
| | 104 | retrieved objects in the per-request memory space of your Apache mod_perl |
| | 105 | processes, when used in conjunction with your actual object driver. It can be |
| | 106 | used to provide even faster results over memcached when requesting objects that |
| | 107 | have already been requested during the same request by some other part of your |
| | 108 | application, at the cost of the memory necessary to store the objects. |
| | 109 | |
| | 110 | If your models can be used in an Apache mod_perl application as well as another |
| | 111 | context such as a command line shell, consider replacing the Apache layer of |
| | 112 | your caching with a C<Data::ObjectDriver::Driver::Cache::RAM> layer when Apache |
| | 113 | is 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 | |
| | 121 | Required members of C<%params> are: |
| | 122 | |
| | 123 | =over 4 |
| | 124 | |
| | 125 | =item * C<fallback> |
| | 126 | |
| | 127 | The C<Data::ObjectDriver> object driver from which to request objects that are |
| | 128 | not found in the Apache process cache. |
| | 129 | |
| | 130 | =back |
| | 131 | |
| | 132 | =back |
| | 133 | |
| | 134 | =head1 DIAGNOSTICS |
| | 135 | |
| | 136 | The Apache driver provides integration with the C<Data::ObjectDriver> debug and |
| | 137 | profiling systems. As these systems are designed around SQL queries, synthetic |
| | 138 | queries are logged to represent caching operations. The operations generated by |
| | 139 | this driver are: |
| | 140 | |
| | 141 | =over 4 |
| | 142 | |
| | 143 | =item * C<APACHECACHE_GET ?> |
| | 144 | |
| | 145 | Retrieve an object. The argument is the cache key for the requested object. |
| | 146 | |
| | 147 | =item * C<APACHECACHE_ADD ?,?> |
| | 148 | |
| | 149 | Add an object to the cache. The arguments are the cache key for the object and |
| | 150 | the flattened representation of the object to cache. |
| | 151 | |
| | 152 | =item * C<APACHECACHE_SET ?,?> |
| | 153 | |
| | 154 | Put an object in the cache. The arguments are the cache key for the object and |
| | 155 | the flattened representation of the object to cache. |
| | 156 | |
| | 157 | =item * C<APACHECACHE_DELETE ?> |
| | 158 | |
| | 159 | Remove an object from the cache. The argument is the cache key for the object |
| | 160 | to invalidate. |
| | 161 | |
| | 162 | =back |
| | 163 | |
| | 164 | =head1 SEE ALSO |
| | 165 | |
| | 166 | =head1 LICENSE |
| | 167 | |
| | 168 | I<Data::ObjectDriver> is free software; you may redistribute it and/or modify |
| | 169 | it under the same terms as Perl itself. |
| | 170 | |
| | 171 | =head1 AUTHOR & COPYRIGHT |
| | 172 | |
| | 173 | Except where otherwise noted, I<Data::ObjectDriver> is Copyright 2005-2006 |
| | 174 | Six Apart, cpan@sixapart.com. All rights reserved. |
| | 175 | |
| | 176 | =cut |