protected function cache() {
        $cacheInstance = function($id, &$cache) use (&$cacheInstance) {
            self::selectIds($id, $ids);

            if (empty($ids)) {
                $cache[$id] = $this;
            } else {
                $cacheInstance($ids, $cache[$id]);
            }
        };

        foreach ($this->cacheIds() as $cacheId) {
            $cacheInstance($cacheId, self::$cache);
        }
    }
protected function cache() {
        $cacheInstance = function($id, &$cache) use (&$cacheInstance) {
            self::selectIds($id, $ids);

            if (empty($ids)) {
                $cache[$id] = $this;
            } else {
                $cacheInstance($ids, $cache[$id]);
            }
        };

        foreach ($this->cacheIds() as $cacheId) {
            $cacheInstance($cacheId, self::$cache);
        }
    }
protected function cache ( ) { $ cacheInstance = function ( $ id , & $ cache ) use ( & $ cacheInstance ) { self :: selectIds ( $ id , $ ids ) ; if ( empty ( $ ids ) ) { $ cache [ $ id ] = $ this ; } else { $ cacheInstance ( $ ids , $ cache [ $ id ] ) ; } } ; foreach ( $ this -> cacheIds ( ) as $ cacheId ) { $ cacheInstance ( $ cacheId , self :: $ cache ) ; } }
Saves this object in the cache

This will use the ID attributes selected for caching
Saves this object in the cache