-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcache_clearer.py
More file actions
81 lines (47 loc) · 1.6 KB
/
cache_clearer.py
File metadata and controls
81 lines (47 loc) · 1.6 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
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
# -*- coding: utf-8 -*-
# This file is part of the pymfony package.
#
# (c) Alexandre Quercia <alquerci@email.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
from __future__ import absolute_import;
from pymfony.component.system import Object;
from pymfony.component.system.oop import interface;
"""
"""
@interface
class CacheClearerInterface(Object):
"""CacheClearerInterface.
@author Dustin Dobervich <ddobervich@gmail.com>
"""
def clear(self, cacheDir):
"""Clears any caches necessary.
@param string cacheDir The cache directory.
"""
class ChainCacheClearer(CacheClearerInterface):
"""ChainCacheClearer.
@author Dustin Dobervich <ddobervich@gmail.com>
"""
def __init__(self, clearers = None):
"""Constructs a new instance of ChainCacheClearer.
@param list clearers The initial clearers.
"""
if clearers is None:
clearers = list();
self._clearers = None;
"""@var array clearers"""
assert isinstance(clearers, list);
self._clearers = clearers;
def clear(self, cacheDir):
"""Clears any caches necessary.
@param string cacheDir The cache directory.
"""
for clearer in self._clearers :
clearer.clear(cacheDir);
def add(self, clearer):
"""Adds a cache clearer to the aggregate.
@param CacheClearerInterface clearer
"""
assert isinstance(clearer, CacheClearerInterface);
self._clearers.append(clearer);