Exactly how/when the values are invalidated is not specified by this API, except that specific values can be forcefully invalidated with ::invalidate(). WARNING: API IN FLUX. DO NOT USE DIRECTLY.
Since: 1.10.0
コード例 #1
0
ファイル: MetastringsTable.php プロジェクト: ibou77/elgg
 /**
  * Gets the id associated with this string, case-sensitively.
  * Will add the string to the table if not present.
  * 
  * @param string $string The value
  * 
  * @return int
  */
 private function getIdCaseSensitive($string)
 {
     $string = (string) $string;
     return $this->cache->get($string, function () use($string) {
         $escaped_string = $this->db->sanitizeString($string);
         $query = "SELECT * FROM {$this->getTableName()} WHERE string = BINARY '{$escaped_string}' LIMIT 1";
         $results = $this->db->getData($query);
         if (isset($results[0])) {
             return $results[0]->id;
         } else {
             return $this->add($string);
         }
     });
 }
コード例 #2
0
 /**
  * Delete URL data from DB and cache
  *
  * @param string $url URL
  * @return bool
  */
 public function delete($url)
 {
     $this->cache->invalidate(sha1($url));
     $dbprefix = elgg_get_config('dbprefix');
     $result = delete_data("\n\t\t\t\tDELETE FROM {$dbprefix}scraper_data\n\t\t\t\tWHERE url = :url\n\t\t", [':url' => (string) $url]);
     return (bool) $result;
 }
コード例 #3
0
ファイル: Datalist.php プロジェクト: cyrixhero/Elgg
 /**
  * Load entire datalist in memory.
  * 
  * This could cause OOM problems if the datalists table is large.
  * 
  * @todo make a list of datalists that we want to get in one grab
  * 
  * @return array
  * @access private
  */
 function loadAll()
 {
     $result = $this->db->getData("SELECT * FROM {$this->table}");
     $map = array();
     if (is_array($result)) {
         foreach ($result as $row) {
             $map[$row->name] = $row->value;
             $this->cache->put($row->name, $row->value);
         }
     }
     return $map;
 }
コード例 #4
0
ファイル: Plugins.php プロジェクト: nirajkaushal/Elgg
 /**
  * Returns an \ElggPlugin object with the path $path.
  *
  * @param string $plugin_id The id (dir name) of the plugin. NOT the guid.
  * @return \ElggPlugin|null
  */
 function get($plugin_id)
 {
     return $this->plugins_by_id->get($plugin_id, function () use($plugin_id) {
         $plugin_id = sanitize_string($plugin_id);
         $db_prefix = get_config('dbprefix');
         $options = array('type' => 'object', 'subtype' => 'plugin', 'joins' => array("JOIN {$db_prefix}objects_entity oe on oe.guid = e.guid"), 'selects' => array("oe.title", "oe.description"), 'wheres' => array("oe.title = '{$plugin_id}'"), 'limit' => 1, 'distinct' => false);
         $plugins = elgg_get_entities($options);
         if ($plugins) {
             return $plugins[0];
         }
         return null;
     });
 }