public function cacheFun($function) {
        if ($this->getConfig('debug') && !is_callable($function))
            echo "no valid function";

        $r = new ReflectionFunction($function);
        $id = null;

        foreach ($r->getStaticVariables() as $key => $var) {
            if ($key == 'key')
                $id = $var;
        }

        if (is_object($id))
            $id = $this->getIDfromOjb($id);

        if ($id == null && $this->getConfig('debug')) {
            echo "no caching key";
            return $function();
        }

        $cachefile = $this->getConfig('cacheDir') . '/' . utf8_decode($id);
        $cachetime = $this->getConfig('cacheTime');

        if (file_exists($cachefile) && time() - $cachetime < fileatime($cachefile)) {
            $ser = file_get_contents($cachefile);
            $val = bzdecompress(unserialize($ser));
            return $val;
        } else {
            $value = $function();
            $ser = serialize(bzcompress($value));
            file_put_contents($cachefile, $ser);
            return $value;
        }

        if ($this->getConfig('debug'))
            echo "no caching";
    }