PHP Classes

File: api/getByIndex.php

Recommend this page to a friend!
  Packages of Dwight José Trujillo Barco   Time Travel Cache   api/getByIndex.php   Download  
File: api/getByIndex.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Time Travel Cache
Store multiple versions of values in cache files
Author: By
Last change:
Date: 2 months ago
Size: 277 bytes
 

Contents

Class file image Download
?<?php
require_once '../src/TimeTravelCache.php';
$cache = new TimeTravelCache();
$key = $_GET['key'] ?? '';
$index = isset($_GET['index']) ? (int)$_GET['index'] : -1;
header('Content-Type: application/json');
echo
json_encode(['value' => $cache->getByIndex($key, $index)]);