aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/ASCache.php
blob: 4904a1d8a9a319a0e388f26b205a5be4cd50865f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php /** @file */

namespace Zotlabs\Lib;

	/**
	 *  A wrapper for the cache api
	 */

class ASCache {
	public static function isEnabled() {
		return Config::Get('system', 'as_object_cache_enabled', true);
	}

	public static function getAge() {
		return Config::Get('system', 'as_object_cache_time', '10 MINUTE');
	}

	public static function Get($key) {
		if (!self::isEnabled()) {
			return;
		}

		return Cache::get($key, self::getAge());
	}

	public static function Set($key, $value) {
		if (!self::isEnabled()) {
			return;
		}

		Cache::set($key, $value);
	}
}