類別圖:快取代理(代理模式)

Example: 快取代理


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
@startuml Example-Cache-Proxy-Pattern

interface Readable
{
+ read(string keyword): array
}

class Database
{
+ read(string keyword): array
}

class CacheProxy
{
# cached: array
# database: Database

+ __construct()
+ read(string keyword): array
}

Readable <|.. CacheProxy
Readable <|.. Database

CacheProxy -> Database

class Program
{
# proxy: CacheProxy

+ __construct()
+ search(string keyword): array
}

Program -> CacheProxy

@enduml

ʕ •ᴥ•ʔ:若不熟悉 UML 類別圖,可參考UML類別圖說明

Share