Store the options and optional block for a call to the cache.

 If no block is provided, create one dynamically.

 @return an AridCache::Store::Blueprint.
501555
def define(object, key, opts, fetch_method=:fetch, method_name=nil, &block)

      # FIXME: Pass default options to store.add
      # Pass nil in for now until we get the cache_ calls working.
      # This means that the first time you define a dynamic cache
      # (by passing in a block), the options you used are not
      # stored in the blueprint and applied to each subsequent call.
      #
      # Otherwise we have a situation where a :limit passed in to the
      # first call persists when no options are passed in on subsequent calls,
      # but if a different :limit is passed in that limit is applied.
      #
      # I think in this scenario one would expect no limit to be applied
      # if no options are passed in.
      #
      # When the cache_ methods are supported, those options should be
      # remembered and applied to the collection however.
      blueprint = AridCache.store.add_object_cache_configuration(object, key, nil, block)
      method_for_cached(object, key, fetch_method, method_name)
      blueprint
    end
491751
public function store($name = null)
    {
        if (is_null($name)) {
            $name = $this->defaultStore;
        }

        if (isset($this->caches[$name])) {
            return $this->caches[$name];
        }

        $config = config('cache.stores.' . $name);
        if ($config === null) {
            throw new InvalidArgumentException('Cache store "' . $name . '" is not defined.');
        }

        if (!isset($config['driver'])) {
            throw new InvalidArgumentException('Cache driver for store "' . $name . '" is not specified.');
        }

        switch ($config['driver']) {
            case 'APCu':
                $provider = new ApcuCache;
                break;
            case 'Array':
                $provider = new ArrayCache;
                break;
            case 'File':
                $provider = new FilesystemCache($config['path']);
                break;
            case 'Memcached':
                $memcached = new Memcached();
                $memcached->addServer($config['host'], $config['port'], $config['weight']);
                $provider = new MemcachedCache();
                $provider->setMemcached($memcached);
                break;
            case 'Redis':
                $redis = new Redis;
                $redis->connect($config['host'], $config['port'], $config['timeout']);
                $provider = new RedisCache;
                $provider->setRedis($redis);
                break;
            default:
                throw new InvalidArgumentException('Cache driver "' . $config['driver'] . '" is not supported.');
        }

        return $this->caches[$name] = new Cache($provider);
    }
220405
protected function createMemcachedStore()
    {
        $serverArray    = $this->config['servers'];
        $persistent     = boolval($this->config['persistent']);
        $name           = trim($this->config['server_name']);
        $prefix         = trim($this->config['prefix']);

        if ($persistent && (strlen($name) > 0)) {
            $memcached  = new Memcached($name);
        } else {
            $memcached  = new Memcached();
        }

        if (!sizeof($memcached->getServerList())) {
            $memcached->addServers($serverArray);
        }

        return new MemcachedStore($memcached, $prefix);
    }
614154
public function store()
    {
        if (!$this->_runtime_queries || $this->already_saved) {
            // No queries to save or already saved
            return;
        }

        // Prevent recursive saves
        $this->already_saved = true;

        $path = defined('PATH') ? PATH : (defined('PATH_INTERNAL') ? PATH_INTERNAL : '');

        $objects = [];
        foreach ($this->_runtime_queries as $query) {
            $query_obj = new DbQueryAnalyzerEntity;
            $query_obj->loadDataFromArray([
                'hash' => md5($query['query']),
                'query' => $query['query'],
                'tt' => round($query['run_time'], 3),
                'path' => $path,
            ]);

            $objects[] = $query_obj;
        }

        // Reset queue
        $this->_runtime_queries = [];

        // Save collected objects
        if ($objects) {
            $query_repository = new DbQueryAnalyzerEntityRepository;
            $query_repository->setCollectedObjects($objects);
            $query_repository->save(); // Save all objects
        }
    }
1049774
public function build()
    {
        return new StoreMap($this->location, $this->update, $this->context, $this->options);
    }
65072
public function save()
    {
        if (null !== $this->cache) {
            $this->loadConfig(null);
            $this->cache->save($this->pool);
        }
        return $this;
    }
16159
public function cache(){

        $args = \func_get_args();

        switch(\count($args)){
        case 1:
            return $this->helper('cache')->read($args[0]);
        case 2:
            return $this->helper('cache')->write($args[0], $args[1]);
        }

        return null;
    }
1294054
protected function createBlueprint()
	{
		$tmpl = file_get_contents( __DIR__ . "/Blueprint.tmpl" );
		$tmpl = str_replace( [ '{{NAME}}', '{{NAMESPACE}}' ], [ $this->name, $this->namespace ], $tmpl );
		$path = app_path( "Contracts/Blueprints/{$this->name}.php" );
		if( ! file_exists( $path ) ) {
			file_put_contents( $path, $tmpl );
		}
	}
167803
public function store()
    {
        $attributes = request()->validate(Page::$rules, Page::$messages);

        $attributes['is_header'] = boolval(input('is_header'));
        $attributes['is_hidden'] = boolval(input('is_hidden'));
        $attributes['is_footer'] = boolval(input('is_footer'));
        $attributes['is_featured'] = boolval(input('is_featured'));
        $attributes['url_parent_id'] = ($attributes['url_parent_id'] == 0 ? $attributes['parent_id'] : $attributes['url_parent_id']);

        $page = $this->createEntry(Page::class, $attributes);

        if ($page) {
            $page->updateUrl()->save();
            $page->banners()->sync(input('banners'));
        }

        return redirect_to_resource();
    }
1196134
public function store()
    {
        try {
            $metric = execute(new CreateMetricCommand(
                Binput::get('name'),
                Binput::get('suffix'),
                Binput::get('description'),
                Binput::get('default_value'),
                Binput::get('calc_type', 0),
                Binput::get('display_chart', true),
                Binput::get('places', 2),
                Binput::get('default_view', Binput::get('view', 1)),
                Binput::get('threshold', 5),
                Binput::get('order', 0),
                Binput::get('visible', 1)
            ));
        } catch (QueryException $e) {
            throw new BadRequestHttpException();
        }

        return $this->item($metric);
    }
483009
def store(key, value, options = {})
      @stack.each {|s| s.store(key, value, options) }
      value
    end
300705
private function cachedAll() {
		if (!isset($this->{__METHOD__})) {
			$this->{__METHOD__} = array_merge($this->cachedAllGlobal(), $this->cachedAllPerStore());
		}
		return $this->{__METHOD__};
	}
741402
public function build() {

        // If we have decided not to backup blocks, prevent anything to be built
        if (!$this->get_setting_value('blocks')) {
            $this->built = true;
            return;
        }

        // If "child" of activity task and it has been excluded, nothing to do
        if (!empty($this->moduleid)) {
            $includedsetting = $this->modulename . '_' . $this->moduleid . '_included';
            if (!$this->get_setting_value($includedsetting)) {
                $this->built = true;
                return;
            }
        }

        // Add some extra settings that related processors are going to need
        $this->add_setting(new backup_activity_generic_setting(backup::VAR_BLOCKID, base_setting::IS_INTEGER, $this->blockid));
        $this->add_setting(new backup_activity_generic_setting(backup::VAR_BLOCKNAME, base_setting::IS_FILENAME, $this->blockname));
        $this->add_setting(new backup_activity_generic_setting(backup::VAR_MODID, base_setting::IS_INTEGER, $this->moduleid));
        $this->add_setting(new backup_activity_generic_setting(backup::VAR_MODNAME, base_setting::IS_FILENAME, $this->modulename));
        $this->add_setting(new backup_activity_generic_setting(backup::VAR_COURSEID, base_setting::IS_INTEGER, $this->get_courseid()));
        $this->add_setting(new backup_activity_generic_setting(backup::VAR_CONTEXTID, base_setting::IS_INTEGER, $this->contextid));

        // Create the block directory
        $this->add_step(new create_taskbasepath_directory('create_block_directory'));

        // Create the block.xml common file (instance + positions)
        $this->add_step(new backup_block_instance_structure_step('block_commons', 'block.xml'));

        // Here we add all the common steps for any block and, in the point of interest
        // we call to define_my_steps() in order to get the particular ones inserted in place.
        $this->define_my_steps();

        // Generate the roles file (optionally role assignments and always role overrides)
        $this->add_step(new backup_roles_structure_step('block_roles', 'roles.xml'));

        // Generate the comments file (conditionally)
        if ($this->get_setting_value('comments')) {
            $this->add_step(new backup_comments_structure_step('block_comments', 'comments.xml'));
        }

        // Generate the inforef file (must be after ALL steps gathering annotations of ANY type)
        $this->add_step(new backup_inforef_structure_step('block_inforef', 'inforef.xml'));

        // Migrate the already exported inforef entries to final ones
        $this->add_step(new move_inforef_annotations_to_final('migrate_inforef'));

        // At the end, mark it as built
        $this->built = true;
    }
622245
public function store()
    {
        // Create a new object
        $item = new $this->model;

        // Remove nested model data from input and prepare to insert on save
        $input = (new NestedModels)->relateTo($item);

        // Hydrate the object
        $item->fill($input);

        // Validate and save.
        $this->validate($item);
        if ($this->parent) {
            $this->parent->{$this->parent_to_self}()->save($item);
        } else {
            $item->save();
        }

        // Redirect to edit view
        if (Request::ajax()) {
            return Response::json(['id' => $item->id]);
        } else {
            return Redirect::to(DecoyURL::relative('edit', $item->id))
            ->with('success', $this->successMessage($item, 'created'));
        }
    }
577518
public function build()
    {
        return new StoreSet($this->location, $this->update, $this->context, $this->options);
    }
293343
private function createDefaultLockStore()
    {
        try {
            $lockPath = Path::create(
                [
                    \sys_get_temp_dir(),
                    '.crunz',
                ]
            );

            $store = new FlockStore($lockPath->toString());
        } catch (InvalidArgumentException $exception) {
            // Fallback to system temp dir
            $lockPath = Path::create([\sys_get_temp_dir()]);
            $store = new FlockStore($lockPath->toString());
        }

        return $store;
    }
1312
public function create(OptionsBag $sessionOptions)
    {
        $options = $this->parseOptions($sessionOptions);

        $connections = $this->parse($sessionOptions);

        $persistentId = null;
        if ($options['persistent']) {
            $persistentId = $this->parsePersistentId($connections, $options, $sessionOptions);
        }

        $class = $this->class;
        /** @var Memcached $memcached */
        $memcached = new $class(
            $persistentId,
            function (Memcached $memcached) use ($connections, $options) {
                $this->configure($memcached, $connections, $options);
            }
        );

        return $memcached;
    }