summaryrefslogtreecommitdiff
path: root/framework/Web/TCacheManager.php
blob: f1c9edd8dda288d834a6a5cb240be17c52536e74 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
/**
<configuration>
  <modules>
	<module id="cache" Expiry="xxx" CacheStorage="file"
			Location="xxx"
	        MemcacheServer="localhost" MemcachePort="1111" />
	<module id="security" MachineKey="xxx" .... />
	<module id="authenticator" ... />
  </modules>
  <services>
    <service id="page" Location="xxx">
	  <module id="asset" UseService="false" Location="xxx" Url="xxx" />
	  <module id="authorizer" />
	</service>
  </services>
</configuration>

<module id="cache" Storage="sqlite,memcache" UniquePrefix="xxx"
        SqliteFile="xxx" MemcacheServer="localhost" MemcachePort="1111"/>
<module id="asset" UseService="true" Location="xxx" Url="xxx" />
<module id="authenticator" LoginUrl="xxxx" />
<module id="authorizer" /> // need to investigate the security of memory cache
 */

/**
<module id="cache" type="System.Modules.TMemCache" Server="localhost" Port="1FileName="xxx" UniquePrefix="" />
*/

/**
<module id="cache" type="System.Modules.TSqliteCache" DbFile="xxx" />
*/


class TAuthencator extends TComponent
{
}

class TAuthorizer extends TComponent
{
}

$cm->generateUniqueID('button:',$id)
$cm->saveValue('template:'.$tmpFile,$template);
$cm->saveValue('application:ID',$appID);
$cm->saveValue('application:hashkey',$key);

class TTemplateManager extends TComponent implements IModule
{
}

class TAssetManager extends TComponent implements IModule
{
	private $_pubDir=null;
	private $_pubUrl=null;

	public function init($context)
	{
		if(is_null($this->_pubDir))
			throw new TCongiruationException('cache_public_location_required');
		if(is_null($this->_pubUrl))
			throw new TCongiruationException('cache_public_url_required');
	}

	public function getPublicLocation()
	{
		return $this->_pubDir;
	}

	public function setPublicLocation($value)
	{
		if(is_dir($value))
			$this->_pubDir=realpath($value);
		else
			throw new TInvalidDataValueException('cache_public_location_invalid');
	}

	public function getPublicUrl()
	{
		return $this->_pubUrl;
	}

	public function setPublicUrl($value)
	{
		$this->_pubUrl=rtrim($value,'/');
	}

	public function publishLocation($path,$forceOverwrite=false)
	{
		$name=basename($path);
		$prefix=md5(dirname($path));
	}

	public function publishFile($path,$forceOverwrite=false)
	{
		if(($fullpath=realpath($path))!==false)
		{
			return $this->_pubUrl.'/'.$fullpath;
		}
		else
			throw new TInvalidDataValueException('cachemanager_path_unpublishable');
	}

	public function unpublishPath($path)
	{
	}
}

class TMemcache extends TComponent
{
}

class TSqliteCache extends TComponent
{
}
?>