Changes between Version 1 and Version 2 of XcacheApi


Ignore:
Timestamp:
2006-05-19T08:50:22+02:00 (9 years ago)
Author:
moo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • XcacheApi

    v1 v2  
    2727{{{
    2828<?php
     29
    2930function load_abc_data()
    3031{
    31   if (xcache_isset("cache")) {
    32     return xcache_get("cache");
     32  if (xcache_isset("abc_data")) {
     33    return xcache_get("abc_data");
    3334  }
    34   $fp = fopen(TMPDIR . "/cache.lock");
     35  // it worth lock here
     36  $fp = fopen(TMPDIR . "/abc_data.lock");
    3537  flock($fp, LOCK_EX);
    3638  // check AGAIN after we get the lock
    37   if (xcache_isset("cache")) {
     39  if (xcache_isset("abc_data")) {
    3840    fclose($fp);
    39     return xcache_get("cache");
     41    return xcache_get("abc_data");
    4042  }
    4143  mysql_query .... and get $data
     
    4446  return $data;
    4547}
     48
     49?>
    4650}}}
    4751