1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-06-05 21:59:25 +02:00

move requests to backend (#18)

This commit is contained in:
Daniel Waxweiler
2024-04-05 23:26:11 +02:00
committed by GitHub
parent 3269ccca1a
commit dc1949ba4c
37 changed files with 2369 additions and 164 deletions

View File

@@ -0,0 +1,19 @@
<?php
namespace MobilizonConnector;
final class EventsCache {
private static $MAX_AGE_IN_S = 120;
public static function set(array $parameters, mixed $data): void {
// md5 is used as key must be 172 characters or fewer in length.
$key = md5(json_encode($parameters));
set_transient($key, $data, self::$MAX_AGE_IN_S);
}
public static function get(array $parameters): mixed {
$key = md5(json_encode($parameters));
$data = get_transient($key);
return $data;
}
}