File: SpotCache.php

package info (click to toggle)
spotweb 20130826%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,132 kB
  • ctags: 11,281
  • sloc: php: 31,367; xml: 1,009; sh: 148; makefile: 83
file content (44 lines) | stat: -rwxr-xr-x 1,150 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
42
43
44
<?php

class SpotCache {
	protected $_db;

	const SpotImage			= 1;
	const SpotNzb			= 2;
	const Web				= 3;
	const Statistics		= 4;
	const StatisticsData	= 5;

	function __construct(SpotDb $db) {
		$this->_db = $db;
	} # ctor

	function isCached($resourceid, $cachetype) {
		return $this->_db->isCached($resourceid, $cachetype);
	} # isCached

	function getCache($resourceid, $cachetype) {
		SpotTiming::start(__FUNCTION__);
		$data = $this->_db->getCache($resourceid, $cachetype);
		SpotTiming::stop(__FUNCTION__, array($data));

		if ($data) {
			return $data;
		} else {
			return false;
		} # else
	} # getCache

	function saveCache($resourceid, $cachetype, $metadata, $content) {
		SpotTiming::start(__FUNCTION__);
		$this->_db->saveCache($resourceid, $cachetype, $metadata, $content);
		SpotTiming::stop(__FUNCTION__, array($resourceid, $cachetype, $metadata, $content));
	} # saveCache

	function updateCacheStamp($resourceid, $cachetype) {
		SpotTiming::start(__FUNCTION__);
		$this->_db->updateCacheStamp($resourceid, $cachetype);
		SpotTiming::stop(__FUNCTION__, array($resourceid, $cachetype));
	} # updateCacheStamp
	
} # class SpotCache