DataObjects/Core_domain.php
authorAlan <alan@roojs.com>
Fri, 6 Oct 2023 04:03:55 +0000 (12:03 +0800)
committerAlan <alan@roojs.com>
Fri, 6 Oct 2023 04:03:55 +0000 (12:03 +0800)
DataObjects/Core_domain.php

index 753c855..8c6bc83 100644 (file)
@@ -18,12 +18,19 @@ class Pman_Core_DataObjects_Core_domain extends DB_DataObject
     function loadOrCreate($dom)
     {
         // should we validate domain?
+        static $cache = array();
+        if (isset($cache[$dom])) {
+            return $cache[$dom];
+        }
+        
         $cd = DB_DataObject::Factory($dom);
         if ($cd->get('domain', $dom)) {
+            $cache[$dom] = $cd;
             return $cd;
         }
         $cd->domain = $dom;
         $cd->insert();
+        $cache[$dom] = $cd;
         return $cd;
     }
 }