Switched to Index Cache wrapper.

This commit is contained in:
flash 2024-04-10 23:44:10 +00:00
parent 9741345a08
commit 2806fcd9ab
2 changed files with 18 additions and 17 deletions

29
composer.lock generated
View file

@ -62,7 +62,7 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://patchii.net/flash/index.git", "url": "https://patchii.net/flash/index.git",
"reference": "9d5b050b8928435416a7efbebe2a19ae8e626224" "reference": "e4c8ed711e045cffe840ba10a239ede14b0b171f"
}, },
"require": { "require": {
"ext-mbstring": "*", "ext-mbstring": "*",
@ -100,7 +100,7 @@
], ],
"description": "Composer package for the common library for my projects.", "description": "Composer package for the common library for my projects.",
"homepage": "https://railgun.sh/index", "homepage": "https://railgun.sh/index",
"time": "2024-03-28T23:27:04+00:00" "time": "2024-04-10T23:40:14+00:00"
}, },
{ {
"name": "flashwave/sasae", "name": "flashwave/sasae",
@ -616,16 +616,16 @@
}, },
{ {
"name": "sentry/sentry", "name": "sentry/sentry",
"version": "4.6.1", "version": "4.7.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/getsentry/sentry-php.git", "url": "https://github.com/getsentry/sentry-php.git",
"reference": "5a94184175e5830b589bf923da8c9c3af2c0f409" "reference": "d6769b2a5e6bf19ed3bbfbf52328ceaf8e6fcb1f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/5a94184175e5830b589bf923da8c9c3af2c0f409", "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/d6769b2a5e6bf19ed3bbfbf52328ceaf8e6fcb1f",
"reference": "5a94184175e5830b589bf923da8c9c3af2c0f409", "reference": "d6769b2a5e6bf19ed3bbfbf52328ceaf8e6fcb1f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -689,7 +689,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/getsentry/sentry-php/issues", "issues": "https://github.com/getsentry/sentry-php/issues",
"source": "https://github.com/getsentry/sentry-php/tree/4.6.1" "source": "https://github.com/getsentry/sentry-php/tree/4.7.0"
}, },
"funding": [ "funding": [
{ {
@ -701,7 +701,7 @@
"type": "custom" "type": "custom"
} }
], ],
"time": "2024-03-08T08:18:09+00:00" "time": "2024-04-10T13:22:13+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -772,16 +772,16 @@
}, },
{ {
"name": "symfony/mime", "name": "symfony/mime",
"version": "v7.0.3", "version": "v7.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/mime.git", "url": "https://github.com/symfony/mime.git",
"reference": "c1ffe24ba6fdc3e3f0f3fcb93519103b326a3716" "reference": "99362408c9abdf8c7cadcf0529b6fc8b16f5ace2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/c1ffe24ba6fdc3e3f0f3fcb93519103b326a3716", "url": "https://api.github.com/repos/symfony/mime/zipball/99362408c9abdf8c7cadcf0529b6fc8b16f5ace2",
"reference": "c1ffe24ba6fdc3e3f0f3fcb93519103b326a3716", "reference": "99362408c9abdf8c7cadcf0529b6fc8b16f5ace2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -801,6 +801,7 @@
"league/html-to-markdown": "^5.0", "league/html-to-markdown": "^5.0",
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
"symfony/dependency-injection": "^6.4|^7.0", "symfony/dependency-injection": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0",
"symfony/property-access": "^6.4|^7.0", "symfony/property-access": "^6.4|^7.0",
"symfony/property-info": "^6.4|^7.0", "symfony/property-info": "^6.4|^7.0",
"symfony/serializer": "^6.4|^7.0" "symfony/serializer": "^6.4|^7.0"
@ -835,7 +836,7 @@
"mime-type" "mime-type"
], ],
"support": { "support": {
"source": "https://github.com/symfony/mime/tree/v7.0.3" "source": "https://github.com/symfony/mime/tree/v7.0.6"
}, },
"funding": [ "funding": [
{ {
@ -851,7 +852,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-01-30T08:34:29+00:00" "time": "2024-03-21T19:37:36+00:00"
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",

View file

@ -3,6 +3,7 @@ namespace Makai\Whois;
use Exception; use Exception;
use Memcached; use Memcached;
use Index\Cache\CacheTools;
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler}; use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
use Sasae\SasaeEnvironment; use Sasae\SasaeEnvironment;
use Makai\CSRFPContainer; use Makai\CSRFPContainer;
@ -45,11 +46,10 @@ class WhoisRoutes extends RouteHandler {
$source = ''; $source = '';
try { try {
$cache = new Memcached; $cache = CacheTools::create('memcached://localhost');
$cache->addServer('localhost', 11211);
$result = $cache->get($prefix . $hash); $result = $cache->get($prefix . $hash);
if($result === false) { if($result === null) {
$client = new WhoisClient; $client = new WhoisClient;
$result = $client->lookup($target); $result = $client->lookup($target);
$cache->set($prefix . $hash, serialize($result), 1800); $cache->set($prefix . $hash, serialize($result), 1800);