diff --git a/www-api/app/Controllers/BaseController.php b/www-api/app/Controllers/BaseController.php index 9872b976..8aaeda78 100644 --- a/www-api/app/Controllers/BaseController.php +++ b/www-api/app/Controllers/BaseController.php @@ -112,6 +112,16 @@ abstract class BaseController extends Controller } return $data; } + + public function deleteCache($cacheKey){ + $data = []; + $cacheKey = $this->cache_tag."-".$cacheKey; + if (cache($cacheKey)) { + // echo 'Getting Data From Cache!
'; + $data = unserialize(cache()->delete($cacheKey)); + } + return $data; + } private function data_stringify($data) { switch (gettype($data)) { case 'string' : return '\''.addcslashes($data, "'\\").'\''; diff --git a/www-api/app/Controllers/WrenchUserContacts.php b/www-api/app/Controllers/WrenchUserContacts.php index 052effbc..d775f1b6 100644 --- a/www-api/app/Controllers/WrenchUserContacts.php +++ b/www-api/app/Controllers/WrenchUserContacts.php @@ -39,8 +39,23 @@ class WrenchUserContacts extends BaseController $endpoint = "CONTACTS_IMPORT_ACTION-". $in["uid"]; $outC = $this->getCache($endpoint); // try find in cache + if ( $in["mmode"] == 0 ){ + $this->deleteCache($endpoint); + $this->saveCache($endpoint,$in,1300); + } + else + { + $outC = $this->getCache($endpoint); // try find in cache + $in["raw_contacts"] = $in["raw_contacts"].$outC["raw_contacts"]; + $this->deleteCache($endpoint); + $this->saveCache($endpoint,$in,1300); + /* + Determine if this is the last + Fire process events + save to the backend database; + */ + } - $this->saveCache($endpoint,$in,300); ///=== cache game gere $in["raw_contacts"] = serialize($in['raw_contacts'].$in["m2"].$in["m3"]);