-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMaxLogic.Cache.RepositoryBase.pas
More file actions
51 lines (40 loc) · 1.09 KB
/
MaxLogic.Cache.RepositoryBase.pas
File metadata and controls
51 lines (40 loc) · 1.09 KB
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
unit MaxLogic.Cache.RepositoryBase;
{$I fpc_delphimode.inc}
{$SCOPEDENUMS ON}
interface
uses
System.SysUtils,
MaxLogic.Cache;
type
TMaxCacheRepositoryBase = class abstract
private
fCache: IMaxCache;
protected
class function TenantNamespace(const aDbName: string): string; static;
class function FilesNamespace: string; static;
class function SiteNamespace(const aSiteId: string): string; static;
property Cache: IMaxCache read fCache;
public
constructor Create(const aCache: IMaxCache);
end;
implementation
constructor TMaxCacheRepositoryBase.Create(const aCache: IMaxCache);
begin
inherited Create;
if aCache = nil then
raise EArgumentNilException.Create('Cache is required');
fCache := aCache;
end;
class function TMaxCacheRepositoryBase.TenantNamespace(const aDbName: string): string;
begin
Result := 'tenant:' + aDbName;
end;
class function TMaxCacheRepositoryBase.FilesNamespace: string;
begin
Result := 'files';
end;
class function TMaxCacheRepositoryBase.SiteNamespace(const aSiteId: string): string;
begin
Result := 'site:' + aSiteId;
end;
end.