@@ 211-222 (lines=12) @@ | ||
208 | * @param String $name |
|
209 | * @return Mixed |
|
210 | */ |
|
211 | protected function getFromCache($name) |
|
212 | { |
|
213 | if ($this->getAllowCaching()) { |
|
214 | $name = "CampaignMonitorAPIConnector_".$name; |
|
215 | $cache = SS_Cache::factory($name); |
|
216 | $value = $cache->load($name); |
|
217 | if (!$value) { |
|
218 | return null; |
|
219 | } |
|
220 | return unserialize($value); |
|
221 | } |
|
222 | } |
|
223 | ||
224 | /** |
|
225 | * @param Mixed $unserializedValue |
|
@@ 228-237 (lines=10) @@ | ||
225 | * @param Mixed $unserializedValue |
|
226 | * @param String $name |
|
227 | */ |
|
228 | protected function saveToCache($unserializedValue, $name) |
|
229 | { |
|
230 | if ($this->getAllowCaching()) { |
|
231 | $serializedValue = serialize($unserializedValue); |
|
232 | $name = "CampaignMonitorAPIConnector_".$name; |
|
233 | $cache = SS_Cache::factory($name); |
|
234 | $cache->save($serializedValue, $name); |
|
235 | return true; |
|
236 | } |
|
237 | } |
|
238 | ||
239 | ||
240 | /******************************************************* |