Example #1
0
 /**
  * Tests whether getFromCache() works as expected.
  *
  * @return void
  */
 public function testGetFromCache()
 {
     $cache = new ArrayCache();
     // check first call
     $this->assertSame('first call', CacheUtil::getFromCache($cache, 'foobar', function () {
         return 'first call';
     }));
     // check following calls
     $this->assertSame('first call', CacheUtil::getFromCache($cache, 'foobar', function () {
         return 'second call';
     }));
 }
Example #2
0
 /**
  * Returns the asset base URL.
  *
  * @return \Ableron\Lib\Net\Uri
  */
 public static function getAssetBaseUrl()
 {
     return clone CacheUtil::getFromCache(self::getCache(), __FUNCTION__, function () {
         return new Uri(rtrim(self::getSiteUrl()->toString(), '/') . '/assets');
     });
 }