From a904c5c634c5d3c202582fdd519db253730f3263 Mon Sep 17 00:00:00 2001 From: thisgun Date: Thu, 23 Mar 2023 12:00:05 +0900 Subject: [PATCH] =?UTF-8?q?Object=20cache=EC=9D=98=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=EB=A5=BC=20=EC=82=AD=EC=A0=9C=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EB=AA=BB=ED=95=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Cache/obj.class.php | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/Cache/obj.class.php b/lib/Cache/obj.class.php index ee6bcebcf..807be9f20 100644 --- a/lib/Cache/obj.class.php +++ b/lib/Cache/obj.class.php @@ -61,29 +61,39 @@ Class G5_object_cache { $this->contents[$group][$key] = $data; break; default : - $datas = $this->etcs[$group][$key] = $data; + $this->etcs[$group][$key] = $data; break; } } + /** + * cache 데이터 제거 + * @param string $type + * @param string $key + * @param string $group + * @return bool + * kkigomi 님이 고쳐주심 + */ + function delete($type, $key, $group = 'default') + { + if (!$this->exists($type, $key, $group)) { + return false; + } - function delete($key, $group='default') { - switch ($key) { + switch ($type) { case 'bbs': - $datas = $this->writes; + $datas = &$this->writes; break; case 'content': - $datas = $this->contents; + $datas = &$this->contents; break; - default : - $datas = $this->etcs; + default: + $datas = &$this->etcs; break; } - if ( ! $this->exists('bbs', $key, $group) ) - return false; + unset($datas[$group][$key]); - unset( $datas[$group][$key] ); return true; }