3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
22 * Interface for the persistence layer of LocalisationCache.
24 * The persistence layer is two-level hierarchical cache. The first level
25 * is the language, the second level is the item or subitem.
27 * Since the data for a whole language is rebuilt in one operation, it needs
28 * to have a fast and atomic method for deleting or replacing all of the
29 * current data for a given language. The interface reflects this bulk update
30 * operation. Callers writing to the cache must first call startWrite(), then
31 * will call set() a couple of thousand times, then will call finishWrite()
32 * to commit the operation. When finishWrite() is called, the cache is
33 * expected to delete all data previously stored for that language.
35 * The values stored are PHP variables suitable for serialize(). Implementations
36 * of LCStore are responsible for serializing and unserializing.
42 * @param string $code Language code
43 * @param string $key Cache key
45 function get( $code, $key );
48 * Start a write transaction.
49 * @param string $code Language code
51 function startWrite( $code );
54 * Finish a write transaction.
56 function finishWrite();
59 * Set a key to a given value. startWrite() must be called before this
60 * is called, and finishWrite() must be called afterwards.
64 function set( $key, $value );