PHP caching class
<p>I'm a AS3 coder and i do a bit of php and i am having a hard time doing a static class that can cache variables.</p>

<p>Here's what i have so far :</p>

<pre><code>&lt;?php
class Cache {

private static $obj;

public static function getInstance() {
    if (is_null(self::$obj)){
        $obj = new stdClass();
    }
    if (!self::$instance instanceof self) { 
        self::$instance = new self;
    }
    return self::$instance;
}

public static function set($key,$value){
  self::$obj-&gt;$key = $value;
}

public static function get($key){
  return  self::$obj-&gt;$key;
}
}
?&gt;
</code></pre>

<p>And i use the following to set my variable into an object of my static class :</p>

<pre><code>&lt;?php 
include 'cache.php';
$cache = new Cache();
$cache-&gt;set("foo", "bar");
?&gt;
</code></pre>

<p>And this is retrieve the variable</p>

<pre><code> &lt;?php 
include 'cache.php';
$cache = new Cache();
$echo = $cache-&gt;get("foo");
echo $echo //doesn't echo anything
?&gt;
</code></pre>

<p>What am i doing wrong ? Thank you</p>
