Create new cached image and run callback
(requires additional package intervention/imagecache)

@param Closure $callback
@param int     $lifetime
@param boolean $returnObj

@return Image
352525
public function cache(Closure $callback, $lifetime = null, $returnObj = false)
    {
        if (class_exists('Intervention\\Image\\ImageCache')) {
            // create imagecache
            $imagecache = new ImageCache($this);

            // run callback
            if (is_callable($callback)) {
                $callback($imagecache);
            }

            return $imagecache->get($lifetime, $returnObj);
        }

        throw new \Intervention\Image\Exception\MissingDependencyException(
            "Please install package intervention/imagecache before running this function."
        );
    }
994923
public function cacheCallback($method, $args, Closure $callback, $time = null)
    {
        // Cache disabled, just execute query & return result
        if ($this->skippedCache() === true) {
            return call_user_func($callback);
        }

        // Use the called class name as the tag
        $tag = get_called_class();

        return self::getCacheInstance()->tags(['repositories', $tag])->remember(
            $this->getCacheKey($method, $args, $tag),
            $this->getCacheExpiresTime($time),
            $callback
        );
    }
239720
public function get($lifetime = null, $returnObj = false)
    {
        $lifetime = is_null($lifetime) ? $this->lifetime : intval($lifetime);

        $key = $this->checksum();

        // try to get image from cache
        $cachedImageData = $this->cache->get($key);

        // if imagedata exists in cache
        if ($cachedImageData) {

            // transform into image-object
            if ($returnObj) {
                $image = $this->manager->make($cachedImageData);
                $cachedImage = new CachedImage;
                return $cachedImage->setFromOriginal($image, $key);
            }

            // return raw data
            return $cachedImageData;

        } else {

            // process image data
            $image = $this->process();

            // encode image data only if image is not encoded yet
            $encoded = $image->encoded ? $image->encoded : (string) $image->encode();

            // save to cache...
            $this->cache->put($key, $encoded, Carbon::now()->addMinutes($lifetime));

            // return processed image
            return $returnObj ? $image : $encoded;
        }
    }
240065
public function table($table, Closure $callback)
    {
        $blueprint = $this->createBlueprint($table);

        $callback($blueprint);

        foreach ($blueprint->getCommands() as $command) {
            if ($command->get('name') == 'drop') {
                $this->helper->dropAutoIncrementObjects($table);
            }
        }

        $this->build($blueprint);

        $this->comment->setComments($blueprint);
    }
442541
public function set($id, $data, $lifetime = 0) {
		if (! $this->connectionCheckStatus) {
			$this->addServer();
		}
		
		$id          = $this->prepareId($id);
		$compression = $this->compression ? MEMCACHE_COMPRESSED : 0;
		
		$result = $this->getClient()->set($id, $data, $compression, $lifetime);
		
		if ($result === false && $this->operationsExceptions) {
			throw new OperationFailed('Inserting of the data into the cache failed, ID: "' . $id . '"');
		}
		
		return $result;
	}
1234520
public static function make(ContainerAwareInterface $container, Closure $callback = null)
    {
        $collection = new AssetCollection(new Asset($container));

        if (is_null($callback)) {
            return $collection->asset();
        }

        return $callback($collection);
    }
971315
public function table($table, Closure $callback) {
        $blueprint = $this->createBlueprint($table, $callback);
        $this->build($blueprint);
        $class = $this->connection->getClient()->makeClass($blueprint->getTable());
        $class->setProperty($blueprint->getColumns());
        $class->saveProperties();
    }
1253531
public function callback(Closure $callback)
    {
        foreach ($this->getInnerIterator() as $key => $value) {
            yield $callback($value, $key);
        }
    }
389088
public static function make(Closure $callback = null)
    {
        if ($callback instanceof Closure) {
            return $callback(new static(Security::create()));
        }

        return new static(Security::create());
    }
896372
public function extend($driver, Closure $callback)
    {
        $this->factory->extend($driver, $callback);

        return $this;
    }
793084
private function doBeforeQuery($callback, $methodName, $arguments)
    {
        $traits = $this->getUsedTraits();

        if (in_array(CacheResults::class, $traits) && $this->caching && $this->isCacheableMethod($methodName)) {
            return $this->processCacheRequest($callback, $methodName, $arguments);
        }

        return $callback();
    }
65615
public static TextureCallback wrapCallback(
            ResourceCache<GVRImage> cache, TextureCallback callback) {
        return new TextureCallbackWrapper(cache, callback);
    }
108009
protected function createBlueprint($table, Closure $callback = null)
    {
        if (isset($this->resolver))
        {
            return call_user_func($this->resolver, $table, $callback);
        }

        return new Blueprint($table, $callback);
    }
1293084
function create(requestObj, callback) {
           
            var storage = this;

            callback = callback || function defaultPostCallback() {
                //setup Error Notification here
            };
            
            if ((typeof requestObj) === 'undefined' || requestObj === null) {
               callback();
               return this;
            }
            
            requestObj.data.id = this._generateUid();

			for (i = 0; i < storage.preprocessors.length; i++) {
                requestObj.data = storage.preprocessors[i](requestObj.data, requestObj);
            }
            this.storage[requestObj.data.id] = requestObj.data;
            
            var data = this.storage[requestObj.data.id];            

            for (i = 0; i < storage.processors.length; i++) {
                data = storage.processors[i](data);
            }
            callback(data);
            
            return this;
        }
343215
public function useResultCache($bool, $lifetime = null, $resultCacheId = null)
    {
        if ($bool) {
            $this->setResultCacheLifetime($lifetime);
            $this->setResultCacheId($resultCacheId);

            return $this;
        }

        $this->_queryCacheProfile = null;

        return $this;
    }
1300126
protected function cacheCallback($class, $method, $args, Closure $closure)
    {
        $repositoryId = $this->getRepositoryId();
        $lifetime     = $this->getCacheLifetime();
        $hash         = $this->generateCacheHash($args);
        $cacheKey     = $class.'@'.$method.'.'.$hash;

        // Switch cache driver on runtime
        if ($driver = $this->getCacheDriver()) {
            $this->getContainer('cache')->setDefaultDriver($driver);
        }

        // We need cache tags, check if default driver supports it
        if (method_exists($this->getContainer('cache')->getStore(), 'tags')) {
            $result = $lifetime === -1
                ? $this->getContainer('cache')->tags($repositoryId)->rememberForever($cacheKey, $closure)
                : $this->getContainer('cache')->tags($repositoryId)->remember($cacheKey, $lifetime, $closure);

            // We're done, let's clean up!
            $this->resetRepository();

            return $result;
        }

        // Default cache driver doesn't support tags, let's do it manually
        $this->storeCacheKeys($class, $method, $hash);

        $result = $lifetime === -1
            ? $this->getContainer('cache')->rememberForever($cacheKey, $closure)
            : $this->getContainer('cache')->remember($cacheKey, $lifetime, $closure);

        // We're done, let's clean up!
        $this->resetCachedRepository();

        return $result;
    }
669798
public function runCallback( \Closure $callback, $postReinitialize = true )
    {
        $this->requestInit();

        try
        {
            $return = $callback();
        }
        catch ( Exception $e )
        {
            $this->shutdown( $postReinitialize );
            throw $e;
        }

        $this->shutdown( $postReinitialize );

        return $return;
    }