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.
С версии: 1.10.0
Пример #1
0
 /**
  * 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
 /**
  * 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
 /**
  * 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;
     });
 }