LdapTools\Cache\CacheInterface::get PHP 메소드

get() 공개 메소드

Retrieve an item from the cache. If it is not in the cache it should return null. However, you should call the contains method first rather than relying on that value.
public get ( $itemType, $itemName ) : mixed
$itemType
$itemName
리턴 mixed
    public function get($itemType, $itemName);

Usage Example

 function it_should_not_call_the_load_schema_event_when_retrieving_from_the_cache(CacheInterface $cache, SchemaParserInterface $parser, $dispatcher)
 {
     $cache->getUseAutoCache()->willReturn(true);
     $cache->contains(LdapObjectSchema::getCacheType(), 'ad.user')->willReturn(true);
     $cache->getCacheCreationTime(LdapObjectSchema::getCacheType(), 'ad.user')->willReturn(new \DateTime('2015-1-3'));
     $cache->set(Argument::any())->shouldNotBeCalled();
     $cache->get(LdapObjectSchema::getCacheType(), 'ad.user')->willReturn(new LdapObjectSchema('ad', 'user'));
     $parser->parse('ad', 'user')->shouldNotBeCalled();
     $parser->getSchemaModificationTime('ad')->willReturn(new \DateTime('2015-1-2'));
     new LdapObjectSchemaEvent(Event::LDAP_SCHEMA_LOAD, new LdapObjectSchema('ad', 'user'));
     $dispatcher->dispatch(Argument::type('\\LdapTools\\Event\\LdapObjectSchemaEvent'))->shouldNotBeCalled();
     $this->beConstructedWith($cache, $parser, $dispatcher);
     $this->get('ad', LdapObjectType::USER);
 }