public function put($url, $data, $result)
    {
        if (!array_key_exists('$data', $result)) {
            $result['$data'] = null; // Allows for null response
        }

        $this->get_versions();

        $cache_content = $result;
        $cache_content['$cached'] = true;

        $cache_key = $this->get_key($url, $data);
        $cache_path = $this->get_path($cache_key, 'result');
        if ($size = $this->write_cache($cache_path, $cache_content)) {
            if (isset($result['$cached'])) {
                $cached = $result['$cached'];
                foreach ($this->result_collections($result) as $collection) {
                    // Collection may not be cacheable
                    if (!isset($cached[$collection]) && !isset($this->versions[$collection])) {
                        continue;
                    }
                    $this->put_index($collection, $cache_key, $size);
                    if (isset($cached[$collection])) {
                        $this->put_version($collection, $cached[$collection]);
                    }
                }
            }
        }
    }