PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.6
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.6
28.6 28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 All 130 releases
wordpress-seo / src / expiring-store / application / ports / expiring-store-repository-interface.php

expiring-store-repository-interface.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.6, at src/expiring-store/application/ports/expiring-store-repository-interface.php

62 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
4 namespace Yoast\WP\SEO\Expiring_Store\Application\Ports;
5
6 /**
7 * Port for the expiring store repository.
8 */
9 interface Expiring_Store_Repository_Interface {
10
11 /**
12 * Inserts or replaces a value in the expiring store.
13 *
14 * @param string $key The key to store.
15 * @param string $json_value The JSON-encoded value.
16 * @param string $expiration_datetime The expiration datetime in 'Y-m-d H:i:s' format.
17 *
18 * @return void
19 */
20 public function upsert( string $key, string $json_value, string $expiration_datetime ): void;
21
22 /**
23 * Finds a non-expired value by key.
24 *
25 * @param string $key The key to find.
26 * @param string $current_datetime The current datetime in 'Y-m-d H:i:s' format.
27 *
28 * @return string|null The JSON-encoded value, or null if not found or expired.
29 */
30 public function find( string $key, string $current_datetime ): ?string;
31
32 /**
33 * Inserts a value only if the key does not already exist or has expired.
34 *
35 * @param string $key The key to store.
36 * @param string $json_value The JSON-encoded value.
37 * @param string $expiration_datetime The expiration datetime in 'Y-m-d H:i:s' format.
38 * @param string $current_datetime The current datetime in 'Y-m-d H:i:s' format.
39 *
40 * @return bool True if the value was inserted or an expired row was replaced, false if the key already exists and is not expired.
41 */
42 public function insert_if_absent( string $key, string $json_value, string $expiration_datetime, string $current_datetime ): bool;
43
44 /**
45 * Deletes a value by key.
46 *
47 * @param string $key The key to delete.
48 *
49 * @return void
50 */
51 public function delete( string $key ): void;
52
53 /**
54 * Deletes all expired entries.
55 *
56 * @param string $current_datetime The current datetime in 'Y-m-d H:i:s' format.
57 *
58 * @return int The number of deleted rows.
59 */
60 public function delete_expired( string $current_datetime ): int;
61 }
62