aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Cache.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2018-12-03 00:08:04 +0100
committerVirtualTam <virtualtam@flibidi.net>2019-01-12 22:47:48 +0100
commitdfc650aa239d3a2c028d0ba13132ce75b4f4c0b4 (patch)
tree4b3f54ecfe27e57fd5d32f3543f688c545588aab /application/Cache.php
parentf3d2f257946e2a3c8791c1ba99b379acbe934fec (diff)
downloadShaarli-dfc650aa239d3a2c028d0ba13132ce75b4f4c0b4.tar.gz
Shaarli-dfc650aa239d3a2c028d0ba13132ce75b4f4c0b4.tar.zst
Shaarli-dfc650aa239d3a2c028d0ba13132ce75b4f4c0b4.zip
namespacing: \Shaarli\Feed\{Cache,CachedPage,FeedBuilder}
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'application/Cache.php')
-rw-r--r--application/Cache.php38
1 files changed, 0 insertions, 38 deletions
diff --git a/application/Cache.php b/application/Cache.php
deleted file mode 100644
index e5d43e61..00000000
--- a/application/Cache.php
+++ /dev/null
@@ -1,38 +0,0 @@
1<?php
2/**
3 * Cache utilities
4 */
5
6/**
7 * Purges all cached pages
8 *
9 * @param string $pageCacheDir page cache directory
10 *
11 * @return mixed an error string if the directory is missing
12 */
13function purgeCachedPages($pageCacheDir)
14{
15 if (! is_dir($pageCacheDir)) {
16 $error = sprintf(t('Cannot purge %s: no directory'), $pageCacheDir);
17 error_log($error);
18 return $error;
19 }
20
21 array_map('unlink', glob($pageCacheDir.'/*.cache'));
22}
23
24/**
25 * Invalidates caches when the database is changed or the user logs out.
26 *
27 * @param string $pageCacheDir page cache directory
28 */
29function invalidateCaches($pageCacheDir)
30{
31 // Purge cache attached to session.
32 if (isset($_SESSION['tags'])) {
33 unset($_SESSION['tags']);
34 }
35
36 // Purge page cache shared by sessions.
37 purgeCachedPages($pageCacheDir);
38}