Cache Service API

A simple key/value cache service with file-based persistent storage.

Encoding: Keys and values must be base64-encoded, then URL-encoded (percent-encoding). Example: urlencode(base64_encode("https://example.com"))

Endpoints

1. Get a cached value

GET ?method=get&l=<base64url_key>

Retrieve a cached value by its key (URL).

ParameterDescription
methodget
lBase64url-encoded key (must be a valid URL)

Response:

// Value exists:
{"ok": true, "value": "cached_content", "hash": "md5_hash"}

// Value not found:
{"ok": true, "value": null, "hash": "md5_hash"}

2. Store a value

POST ?method=post&l=<base64url_key>&r=<base64url_value>

Store a value in the cache. Write-once (existing values cannot be overwritten). Only allowed domains can be cached.

ParameterDescription
methodpost
lBase64url-encoded key (must be a valid http/https URL from allowed domain)
rBase64url-encoded value (max 4096 bytes)

Response:

// Success:
{"ok": true, "stored": true, "hash": "md5_hash", "path": "a/b/c/d/e/f/md5_hash"}

// Already exists:
{"ok": true, "stored": false, "hash": "md5_hash", "path": "a/b/c/d/e/f/md5_hash"}

// Domain refused:
{"ok": false, "error": "domain_refused", "domain": "bad.com"}

3. List refused domains

GET ?method=refused

Get a list of domains that were refused in the last 7 days.

{"ok": true, "refused": ["bad.com", "spam.org"]}

4. Documentation

GET / (no method parameter)

This documentation page.

Code Examples

Bash (curl)

# Get a value (curl handles URL-encoding with --data-urlencode)
KEY="https://example.com/page"
ENCODED_KEY=$(echo -n "$KEY" | base64)
curl -G "https://eidjdiziflabrinkj.fr" --data-urlencode "method=get" --data-urlencode "l=$ENCODED_KEY"

# Store a value
VALUE="Hello, World!"
ENCODED_VALUE=$(echo -n "$VALUE" | base64)
curl -X POST -G "https://eidjdiziflabrinkj.fr" --data-urlencode "method=post" --data-urlencode "l=$ENCODED_KEY" --data-urlencode "r=$ENCODED_VALUE"

PHP

$baseUrl = 'https://eidjdiziflabrinkj.fr';
$key = 'https://example.com/page';

// Get a value
$params = http_build_query(['method' => 'get', 'l' => base64_encode($key)]);
$response = file_get_contents("$baseUrl?$params");
$data = json_decode($response, true);
echo $data['value'] ?? 'Not found';

// Store a value
$value = 'Hello, World!';
$params = http_build_query([
    'method' => 'post',
    'l' => base64_encode($key),
    'r' => base64_encode($value)
]);
$ctx = stream_context_create(['http' => ['method' => 'POST']]);
$response = file_get_contents("$baseUrl?$params", false, $ctx);

JavaScript (fetch)

const baseUrl = 'https://eidjdiziflabrinkj.fr';
const key = 'https://example.com/page';

// Get a value
const params = new URLSearchParams({ method: 'get', l: btoa(key) });
const response = await fetch(`${baseUrl}?${params}`);
const data = await response.json();
console.log(data.value);

// Store a value
const value = 'Hello, World!';
const postParams = new URLSearchParams({ method: 'post', l: btoa(key), r: btoa(value) });
await fetch(`${baseUrl}?${postParams}`, { method: 'POST' });

Python (requests)

import requests
import base64

base_url = 'https://eidjdiziflabrinkj.fr'
key = 'https://example.com/page'

def b64(data: str) -> str:
    return base64.b64encode(data.encode()).decode()

# Get a value (requests handles URL-encoding automatically)
response = requests.get(base_url, params={'method': 'get', 'l': b64(key)})
data = response.json()
print(data['value'])

# Store a value
value = 'Hello, World!'
response = requests.post(base_url, params={'method': 'post', 'l': b64(key), 'r': b64(value)})

Error Codes

HTTP CodeErrorDescription
400missing_parameter_*Required parameter missing
400invalid_base64Invalid base64 encoding
400invalid_keyKey too long or invalid UTF-8
400invalid_url_keyKey must be a valid http/https URL
400empty_valueValue cannot be empty
400value_too_longValue exceeds max length
400invalid_methodUnknown method parameter value
403domain_refusedDomain not in allowlist
405method_not_allowedWrong HTTP method (GET vs POST)
500write_failedFailed to write cache file