Return the array key inside a cached array.

@param string $key
@param string $prefix

@return string
501994
protected function arrayKey($key, $prefix)
    {
        $arrayKey = substr($key, strlen($prefix)+1);
        return is_bool($arrayKey) ? '' : $arrayKey;
    }
786575
public function get($key)
    {
        $context = $this->_context;

        if ($context->cache !== null && array_key_exists($key, $context->cache)) {
            return $context->cache[$key];
        } elseif ($this->_enabled) {
            if ($this->_is_cli) {
                if (($r = apcu_fetch($this->_prefix ? ($this->_prefix . $key) : $key)) === false) {
                    return false;
                }
                return time() <= $r[0] ? $r[1] : false;
            } else {
                return apcu_fetch($this->_prefix ? ($this->_prefix . $key) : $key);
            }
        } else {
            return false;
        }
    }
976471
public function get($key)
	{
		$value = wincache_ucache_get($this->prefix.$key);

		if ($value !== false)
		{
			return $value;
		}
	}
799000
public static function getAllArrayItemsByKeyPrefix($array, $prefix, $stripPrefix = false) {
        $returnValues = array();
        foreach ($array as $key => $value) {
            $positionOfPrefix = strpos($key, $prefix);
            if (is_numeric($positionOfPrefix) && $positionOfPrefix == 0) {
                if ($stripPrefix) $key = substr($key, strlen($prefix));
                $returnValues [$key] = $value;
            }
        }

        return $returnValues;
    }
696230
private function getContent( $key, $node, $prefix )
	{
		$content = array();

		switch ( $key )
		{
			case 'annotation':
				// Do nothing
				break;

			case 'attributeGroup':

				if ( ! property_exists( $node->attributes(), 'ref' ) ) continue;
				if ( ! isset( $content['attributeGroups'] ) ) $content['attributeGroups'] = array();

				$ref = (string) $node->attributes()->ref;
				// BMS 2018-04-09 Test candidates changed.
				$ref = $this->normalizePrefix( strpos( $ref, ":" ) ? $ref : "xs:$ref" );

				$attributeGroups =& $this->attributeGroups;

				if ( ! isset( $attributeGroups[ $ref ] ) )
				{
					$this->log->err( "An attribute group '$ref' does not already exist" );
				}

				$content['attributeGroups'][] = $attributeGroups[ $ref ];

				break;

			case 'attribute':

				if ( ! isset( $content['attributes'] ) ) $content['attributes'] = array();
				$attribute = $this->processAttribute( $node, $prefix );
				if ( ! $attribute ) break;
				$content['attributes'][ "{$attribute['prefix']}:{$attribute['name']}" ] = $attribute;

				// Should add attributes to the attributes list
				if ( ! $attribute || isset( $this->attributes[ "{$attribute['prefix']}:{$attribute['name']}" ] ) ) break;
				$name = $attribute['name'];
				$this->attributes[ "$prefix:$name" ] = $attribute;
				if ( isset( $this->types[ "$prefix:$name" ] ) ) break;
				$parent = is_array( $attribute['types'][0] )
					? $attribute['types'][0]['parent']
					: $attribute['types'][0];
				$this->types[ "$prefix:$name" ] = array(
					'parent' => $parent,
					'name' => $name,
					'prefix' => $prefix,
					'class' => 'simple',
					'contentType' => 'attribute',
					'numeric' => isset( $this->types[ $parent ]['numeric'] )
						? $this->types[ $parent ]['numeric']
						: false,
				);

				break;

			case 'anyAttribute':

				$content['any'] = true;

				break;

			case 'choice':

				if ( ! isset( $content['elements'] ) ) $content['elements'] = array();

				foreach ( $node->children( SCHEMA_NAMESPACE ) as $key => $child )
				{
					switch ( $key )
					{
						case 'sequence':

							$element = $this->getContent( $key, $child, $prefix );

							if ( $element )
							{
								$content['elements'] = $element;
							}

							break;

						case 'group':

							$group = $this->processGroup( $node, $prefix );

							if ( $group )
							{
								$content['elements'][ "$prefix:{$element['name']}" ] = $group;
							}

							break;

						case 'element':

							$element = $this->processElement( $child, $prefix );

							if ( $element )
							{
								$elementPrefix = isset( $element['prefix'] ) ? $element['prefix'] : $prefix;
								$content['elements'][ "$elementPrefix:{$element['name']}" ] = $element;
							}

							break;

						case 'any':

							$content['any'] = true;
							break;

						default:

							$this->log->info( "Need to handle choice component '$key'" );
							return false;
					}
				}

				$content['restrictionType'] = "choice";

				break;

			case 'union':

				$memberTypes = $node->attributes()->memberTypes;
				if ( $memberTypes )
				{
					// Get the name of each type
					$localTypes =& $this->types;
					$memberTypes = array_map( function( $typeName ) use( $localTypes ) {
						$typeName = strpos( $typeName, ":" ) ? $typeName : "xs:$typeName";
						return isset( $localTypes[ $typeName ] )
							? $typeName
							: $false;
					}, array_filter( explode( " ", $memberTypes ) ) );

					$content['types'] = array_filter( $memberTypes );
				}

				// Will be either complexType or simpleType
				foreach ( $node->children( SCHEMA_NAMESPACE ) as $child )
				{
					$content['types'][] = $this->handleTypes( $child, $prefix );
				}

				$content['restrictionType'] = "union";

				break;

			case 'sequence':

				$elements = array();
				$elementIndex = 1;
				foreach ( $node->children( SCHEMA_NAMESPACE ) as $seqKey => $child )
				{
					switch ( $seqKey )
					{
						case 'group':

							$group = $this->processGroup( $child, $prefix );

							if ( ! isset( $elements['group'] ) ) $elements['group'] = array();
							foreach ( $group['types'] as $type )
							{
								$elements['group'] = array_merge( $elements['group'], $type );
							}

							break;

						case 'element':

							$el = $this->processElement( $child, $prefix );
							// BMS 2018-05-02
							$elements[ $elementIndex ] = $el;
							$elementIndex++;
							// $elements[ "{$el['prefix']}:{$el['name']}" ] = $el;

							break;

						case 'any':

							$content['any'] = true;
							break;

						case 'choice':

							$el = $this->getContent( $seqKey, $child, $prefix );
							$elements['choice'] = $el;
							break;

						case 'sequence':

							$el = $this->getContent( $seqKey, $child, $prefix );
							$elements['sequence'] = $el;
							break;

						default:

							echo "Handle '$seqKey'";
							break;
					}

				}

				if ( $elements )
				{
					$content['elements'] = $elements;
				}

				$content['restrictionType'] = "union";

				break;

			case 'minLength':

				$content['minLength'] = (string) $node->attributes()->value;

				break;

			case 'maxLength':

				$content['maxLength'] = (string) $node->attributes()->value;

				break;

			case 'minExclusive':

				$content['minExclusive'] = (string) $node->attributes()->value;

				break;

			case 'maxExclusive':

				$content['maxExclusive'] = (string) $node->attributes()->value;

				break;

			case 'length':

				$content['length'] = (string) $node->attributes()->value;

				break;

			case 'enumeration':

				$attribs = $node->attributes();
				$enum = array( 'value' => (string) $attribs->value );
				if ( property_exists( $attribs, 'id' ) )
				{
					$enum['id'] = (string)$attribs->id;
					$name = \XBRL::GUID();
					$this->typeIds[ $enum['id'] ] = array( 'name' => $name, 'istype' => true );
					$this->AddSimpleType( $prefix, $name );
				}

				$content['values'][] = $enum;
				break;

			case 'pattern':

				$content['pattern'] = (string) $node->attributes()->value;

				break;

			case 'maxInclusive':

				$content['maxInclusive'] = (string) $node->attributes()->value;

				break;

			case 'minInclusive':

				$content['minInclusive'] = (string) $node->attributes()->value;

				break;

			default:

				$this->log->info( "Have not used $key" );
				break;
		}

		return $content;
	}
1320336
public static function getFromCache($key)
  {
    static::initialize();
    $v = self::$cm->getFromCache($key);
    return $v ? $v['value'] : null;
  }
788658
public function get($key)
    {
        $value = $this->memcached->get($key);

        return is_array($value) ? $value[0] : $value;
    }
1264550
public function equals(Key $key, $prefix) {
        $prefix .= ': Index (' . $this->getName() . '):';
        $errors = [];
        if($key->getName() !== $this->getName()) {
            throw new \Exception('Comparing Incomparable columns');
        }
        if($key->getType() !== $this->getType()) {
            $errors[] = $prefix . 'Type Does Not Match:' . "\n" . $key->getType() . "\n" . $this->getType();
        }
        $diff = array_diff($key->getColumns(), $this->getColumns());
        if(!empty($diff)) {
            $errors[] = $prefix . 'Extra Columns: ' . "\n" . implode("\n", $diff);
        }
        $diff = array_diff($this->getColumns(), $key->getColumns());
        if(!empty($diff)) {
            $errors[] = $prefix . 'Missing Columns: ' . "\n" . implode("\n", $diff);
        }
        return $errors;
    }
1229057
private function applyPrefix($key)
    {
        $prefix = (string) $this->client->getOption(Redis::OPT_PREFIX);

        return $prefix.$key;
    }
603549
private function resolveKey($keys)
    {
        if (is_array($keys)) {
            $result = [];
            foreach ($keys as $key) {
                $result[] = $this->prefix . $key;
            }

            return $result;
        }

        return $this->prefix . $keys;
    }
614631
public static function arrayPrefixValue($array, $prefix)
    {
        array_walk($array, function (&$item1, $key, $prefix) {
            $item1 = $prefix . $item1;
        }, $prefix);

        return $array;
    }
940468
public function get($key)
    {
        $entry = $this->redis->hGet($this->cacheKey, $key);

        if ($entry) {
            $entry = unserialize($entry);

            if ($entry['expire']) {
                // Check expires
                $now = new \DateTime('now', new \DateTimeZone('UTC'));
                if ((int) $now->format('U') > $entry['expire']) {
                    $this->remove($key);

                    return null;
                }
            }

            return $entry['value'];
        }

        return null;
    }
856398
public function find_by_prefix($prefix) {
        $return = [];
        foreach ($this->find_all() as $key) {
            if (strpos($key, $prefix) === 0) {
                $return[] = $key;
            }
        }
        return $return;
    }
988744
public function getKey(string $prefix = ''): string
    {
        $value = $this->getData();
        if (!is_array($value)) {
            $key = $value ?: '';
        } else {
            if (!empty($this->getAttributes())) {
                $flipped = array_flip($this->getAttributes());
                $value = array_intersect_key($value, $flipped);
            }

            $key = str_replace('=', '_', http_build_query($value, '', '_'));
        }

        return hash(self::ALGORITHM, $prefix.'_'.$key);
    }
41140
public function prefixValues(array $arguments, $prefix)
    {
        $skip = ['id', 'ID'];

        return array_map(function ($key) use ($prefix, $skip) {
            if (in_array($key, $skip)) {
                return $key;
            }

            return "{$prefix}{$key}";
        }, $arguments);
    }
148589
private static function returnKey($key, $mappingArray)
    {
        if (!is_array($mappingArray)) {
            return $key;
        }

        foreach ($mappingArray as $mappingKey => $mappingData) {
            if (is_array($mappingData)) {
                if (isset($mappingData[$key])) {
                    return $mappingData[$key];
                }
            }
            else {
                if ($mappingKey == $key) {
                    return $mappingData;
                }
            }
        }
        return $key;
    }
948351
public function get($key)
    {
        $value = $this->connection()->get($this->prefix.$key);

        return ! is_null($value) ? $this->unserialize($value) : null;
    }