PluginProbe
404 Solution / trunk
404 Solution vtrunk
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / repositories / ContentRepositoryInterface.php

ContentRepositoryInterface.php in 404 Solution trunk, at includes/repositories/ContentRepositoryInterface.php

83 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 require_once __DIR__ . '/PublishedContentLookupInterface.php';
8 require_once __DIR__ . '/OldSlugLookupInterface.php';
9
10 /**
11 * Aggregate type for the content-area repository.
12 *
13 * Bundles the published-content lookup and old-slug lookup sub-interfaces and
14 * declares the permalink-cache and spelling-cache contracts directly. The
15 * permalink/spelling declarations used to live in their own segment interfaces
16 * (PermalinkCacheRepositoryInterface / SpellingCacheRepositoryInterface), but no
17 * caller ever narrowed to a single segment, so they were folded back here to
18 * remove unrealized-ISP indirection. New code should depend on the smallest
19 * sub-interface it actually uses; this composite is preserved so existing typed
20 * callers (e.g. DataAccess delegate, the ContentRepository constructor)
21 * continue to compile.
22 */
23 interface ABJ_404_Solution_ContentRepositoryInterface extends
24 ABJ_404_Solution_PublishedContentLookupInterface,
25 ABJ_404_Solution_OldSlugLookupInterface {
26
27 // --- Permalink cache table: read, write, repopulate, truncate. The cache
28 // exists because resolving a post ID -> permalink is too expensive to do
29 // per-request on large sites, so a denormalized table keeps the answer ready.
30
31 /** @return void */
32 public function truncatePermalinkCacheTable(): void;
33
34 /** @param int $post_id @return void */
35 public function removeFromPermalinkCache(int $post_id): void;
36
37 /**
38 * @param int|string $id
39 * @return string|null
40 */
41 public function getPermalinkFromCache($id);
42
43 /**
44 * @param array<int, int> $ids
45 * @return array<int, object>
46 */
47 public function getPermalinksByIds(array $ids);
48
49 /**
50 * @param int|string $id
51 * @return array<string, mixed>|null
52 */
53 public function getPermalinkEtcFromCache($id);
54
55 /** @return array<string, mixed> */
56 public function updatePermalinkCache();
57
58 /** @return array<string, mixed> */
59 public function updatePermalinkCacheParentPages();
60
61 /** @return int */
62 public function getPermalinkCacheCount(): int;
63
64 // --- Spelling cache: stores the result of an expensive Levenshtein scan
65 // keyed on the requested URL, with explicit invalidation.
66
67 /**
68 * @param string $requestedURLRaw
69 * @param mixed $returnValue
70 * @return void
71 */
72 public function storeSpellingPermalinksToCache(string $requestedURLRaw, $returnValue): void;
73
74 /**
75 * @param string $requestedURLRaw
76 * @return mixed
77 */
78 public function getSpellingPermalinksFromCache(string $requestedURLRaw);
79
80 /** @return void */
81 public function deleteSpellingCache(): void;
82 }
83