aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/ASCache.php
blob: 63bd73ea7616c3fc508858a97910a73de7f9594a (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', false);
	}

	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);
	}
}