Location: PHPKode > projects > Buzzword > buzzword-0.8.12/includes/cache.inc
<?php

/*
 * buzzword
 * Copyright (c) 2003 Jon Tai
 *
 * $Id: cache.inc 314 2004-04-13 06:58:55Z bradt $
 *
 * This file is part of buzzword.
 *
 * buzzword is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * buzzword is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with buzzword; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/**
 * Retrieve a cached row
 */
function get_record($object_name, $object_key) {
    global $BUZZWORD_OBJECT_CACHE;

    if (!isset($BUZZWORD_OBJECT_CACHE[$object_name]))
        return FALSE;

    if (!isset($BUZZWORD_OBJECT_CACHE[$object_name][$object_key]))
        return FALSE;

    return $BUZZWORD_OBJECT_CACHE[$object_name][$object_key];
}

/**
 * Flush a cached row
 */
function flush_record($object_name, $object_key) {
    global $BUZZWORD_OBJECT_CACHE;
    if ( (isset($BUZZWORD_OBJECT_CACHE[$object_name])) && (isset($BUZZWORD_OBJECT_CACHE[$object_name][$object_key])) )
        unset($BUZZWORD_OBJECT_CACHE[$object_name][$object_key]);
}

/**
 * Cache a row from the database
 */
function cache_record($object_name, $object_key, $row) {
    global $BUZZWORD_OBJECT_CACHE;
    $BUZZWORD_OBJECT_CACHE[$object_name][$object_key] = $row;
}

?>
Return current item: Buzzword