Generates the key that should be used for an entry in the useridlist cache.

@param string $id Generate a key for this instance (optional)
@return string The key for the id, or new entry if no $id is passed.
428743
public function get_useridlist_key($id = null) {
        if ($id === null) {
            $id = $this->get_useridlist_key_id();
        }
        return $this->get_course_module()->id . '_' . $id;
    }
235724
public function getRecordCacheKey($id = null)
    {
        return $this->db->getDbname() . ':' . $this->table . ':' . ($id ?: $this['id']);
    }
807478
protected static function getCache($id)
    {
        $type = static::getType();

        $id = (string)$id;

        static::initializeCache($type);

        $collection = self::$cache->{$type};

        if (!property_exists($collection, $id)) {
            return null;
        }

        $resource = $collection->{$id};

        return (clone $resource);
    }
1128833
public static function get_entry_by_id($id) {
        global $DB, $USER;

        $params = self::validate_parameters(self::get_entry_by_id_parameters(), array('id' => $id));
        $id = $params['id'];
        $warnings = array();

        // Get and validate the glossary.
        $entry = $DB->get_record('glossary_entries', array('id' => $id), '*', MUST_EXIST);
        list($glossary, $context) = self::validate_glossary($entry->glossaryid);

        if (empty($entry->approved) && $entry->userid != $USER->id && !has_capability('mod/glossary:approve', $context)) {
            throw new invalid_parameter_exception('invalidentry');
        }

        $entry = glossary_get_entry_by_id($id);
        self::fill_entry_details($entry, $context);

        return array(
            'entry' => $entry,
            'ratinginfo' => \core_rating\external\util::get_rating_info($glossary, $context, 'mod_glossary', 'entry',
                array($entry)),
            'warnings' => $warnings
        );
    }
840406
public function setId($id)
  {
    if ($this->isLocked()) {
      return $this->getObj()->setId($id)->setLocked();
    } else {
      return parent::setId($id);
    }
  }
298194
public function generateEntityCodeAction($id = null)
    {
        $request = $this->getRequest();

        $id = $request->get($this->admin->getIdParameter());
        if ($id) {
            $subject = $this->admin->getObject($id);
            if (!$subject) {
                $error = sprintf('unable to find the object with id : %s', $id);

                return new JsonResponse(['error' => $error]);
            }
            try {
                $this->admin->checkAccess('edit', $subject); // TODO: is it necessary ? (we are not editing the entity)
            } catch (Exception $exc) {
                $error = $exc->getMessage();

                return new JsonResponse(['error' => $error]);
            }
        } else {
            $subject = $this->admin->getNewInstance();
        }

        $this->admin->setSubject($subject);

        $form = $this->admin->getForm();
        $form->setData($subject);
        $form->submit($request->request->get($form->getName()));
        $entity = $form->getData();

        $field = $request->query->get('field', 'code');
        $registry = $this->get('blast_core.code_generators');
        $generator = $registry::getCodeGenerator(get_class($entity), $field);
        try {
            $code = $generator::generate($entity);

            return new JsonResponse(['code' => $code]);
        } catch (\Exception $exc) {
            $error = $this->get('translator')->trans($exc->getMessage());

            return new JsonResponse(['error' => $error, 'generator' => get_class($generator)]);
        }
    }
869439
public static function id($id)
    {
        $class = get_called_class();

        if ($class::$customIdType !== true) {
            if ($id  && strlen($id) == 24 ) {
                $id = new \MongoId($id);
            }
        }

        return self::one(array("_id" => $id));

    }
490481
public function id($id)
    {
        $parts = array_merge(array($this->namespace), func_get_args());
        return trim(implode(self::$namespaceSeparator, $parts), self::$namespaceSeparator);
    }
575953
protected function escapeId($id)
    {
        if (!$this->replace) {
            return $id;
        }

        return str_replace(array_keys($this->replace), array_values($this->replace), $id);
    }
1162258
public static function urlizeId($id)
    {
        if (is_array($id)) {
            $id = rawurlencode('('.self::flexiUrl($id).')');
        } else if (preg_match('/^ext:/', $id)) {
            $id = self::urlEncode($id);
        } else if (preg_match('/^code:/', $id)) {
            $id = self::code(self::urlEncode(self::uncode($id)));
        }
        return $id;
    }
629826
public function get(string $id)
    {
        if (!$this->has($id)) {
            throw EntryNotFoundException::fromId($id);
        }

        return $this->cache[$id];
    }
1144126
public static function getIdValue(array $id) 
    {
        self::formatScalarValues($id);
        if (\is_array($id)) {
            RecursiveDeleteHelper::deleteKeys($id, [Serializer::CLASS_IDENTIFIER_KEY]);
        }

        return $id;
    }
701271
public static function key($group, $id)
    {
        if (!empty($id)) {
            return trim($group, '/') . '/' . trim($id, '/');
        } else {
            return trim($group, '/');
        }
    }
527544
public function getCacheId($id = null)
    {
        $id .= serialize($this->state->toArray());

        return sha1($id);
    }
484599
protected function generatePathname($id)
    {
        if (!file_exists($this->basePath)) {
            mkdir($this->basePath, 0777, true);
        }

        return $this->basePath.'/'.$id;
    }
1299057
public function setId($id = null)
    {
        $this->id = ($id !== null) ? $id : SecureKey::generate();

        return $this;
    }
1160667
protected function doContains($id)
    {

        $md5Key = md5($id);

        $kvm = KVMLogger::instance('anycontent-cache');

        $hit = $this->getCacheProvider()->doContains($md5Key);

        if ($hit)
        {
            $this->hit++;
            $message = $kvm->createLogMessage('Cache hit', [ 'key' => $id, 'md5' => $md5Key, 'namespace' => $this->getNamespace() ]);
            $kvm->debug($message);
        }
        else
        {
            $this->miss++;
            $message = $kvm->createLogMessage('Cache miss', [ 'key' => $id, 'namespace' => $this->getNamespace() ]);
            $kvm->debug($message);
        }

        return $hit;
    }