Persists the payload of a key to the disk.
499075
@Override
    public void store(String key, byte[] payload) throws IOException {
        try {
            Cipher sym = Cipher.getInstance("AES");
            sym.init(Cipher.ENCRYPT_MODE, masterKey);
            try (
                    FileOutputStream fos = new FileOutputStream(getFileFor(key));
                    CipherOutputStream cos = new CipherOutputStream(fos, sym)
            ) {
                cos.write(payload);
                cos.write(MAGIC);
            }
        } catch (GeneralSecurityException e) {
            throw new IOException("Failed to persist the key: " + key, e);
        }
    }
1238343
@Override
    protected void store(ConfidentialKey key, byte[] payload) throws IOException {
        try {
            Cipher sym = Secret.getCipher("AES");
            sym.init(Cipher.ENCRYPT_MODE, masterKey);
            try (OutputStream fos = Files.newOutputStream(getFileFor(key).toPath());
                 CipherOutputStream cos = new CipherOutputStream(fos, sym)) {
                cos.write(payload);
                cos.write(MAGIC);
            }
        } catch (GeneralSecurityException e) {
            throw new IOException("Failed to persist the key: "+key.getId(),e);
        } catch (InvalidPathException e) {
            throw new IOException(e);
        }
    }
625759
def save(self, trial, storage=Checkpoint.DISK):
        """"""
        trial._checkpoint.storage = storage
        trial._checkpoint.last_result = trial.last_result
        if storage == Checkpoint.MEMORY:
            trial._checkpoint.value = trial.runner.save_to_object.remote()
        else:
            # Keeps only highest performing checkpoints if enabled
            if trial.keep_checkpoints_num:
                try:
                    last_attr_val = trial.last_result[
                        trial.checkpoint_score_attr]
                    if (trial.compare_checkpoints(last_attr_val)
                            and not math.isnan(last_attr_val)):
                        trial.best_checkpoint_attr_value = last_attr_val
                        self._checkpoint_and_erase(trial)
                except KeyError:
                    logger.warning(
                        "Result dict has no key: {}. keep"
                        "_checkpoints_num flag will not work".format(
                            trial.checkpoint_score_attr))
            else:
                with warn_if_slow("save_to_disk"):
                    trial._checkpoint.value = ray.get(
                        trial.runner.save.remote())

        return trial._checkpoint.value
1024738
def persist(self, key):
        """"""
        fut = self.execute(b'PERSIST', key)
        return wait_convert(fut, bool)
901120
public synchronized ValT put(KeyT key, ValT value) {
        if (isDiskCacheEnabled) {
            cacheToDisk(key, value);
        }

        return cache.put(key, value);
    }
308922
def put(self, key, value):
    '''
    '''
    path = self.object_path(key)
    self._write_object(path, value)
927380
def store(key, value, mode = nil)
      if mode == :dup
        if value.is_a? Array
          Utilities.temp_list(value.size) do |list|
            list.push(*value) { |string| cast_value_in(string) }
            try(:putdup3, cast_key_in(key), list.pointer)
          end
        else
          try(:putdup, cast_key_in(key), cast_value_in(value))
        end
        value
      else
        super
      end
    end
799655
def _persist(self) -> None:
        
        if self._store:
            self._store.save(self._key, self._snapshot)
19525
function PersistentStorage(namespace, override) {
  this.prefix = ['__', namespace, '__'].join('');
  this.ttlKey = '__ttl__';
  this.keyMatcher = new RegExp('^' + _.escapeRegExChars(this.prefix));

  // for testing purpose
  this.ls = override || LOCAL_STORAGE;

  // if local storage isn't available, everything becomes a noop
  !this.ls && this._noop();
}
845159
def store(self, key, value):
        
        self.client.set(key, value, time=self.timeout)
444053
def persist(self, path_to_file):
        
        with open(path_to_file, 'wb') as f:
            f.write(self.data)
338720
def forever(self, key, value):
        
        namespace = self._tags.get_namespace()

        self._push_forever_keys(namespace, key)

        self._store.forever(
            '%s:%s' % (hashlib.sha1(encode(self._tags.get_namespace())).hexdigest(), key),
            value
        )
12705
def remember_forever(self, key, callback):
        
        # If the item exists in the cache we will just return this immediately
        # otherwise we will execute the given callback and cache the result
        # of that execution forever.
        val = self.get(key)
        if val is not None:
            return val

        val = value(callback)

        self.forever(key, val)

        return val
799325
def _persist(source, path, encoder=None):
        
        import posixpath
        from dask.bytes import open_files
        import dask
        import pickle
        import json
        from intake.source.textfiles import TextFilesSource
        encoder = {None: str, 'str': str, 'json': json.dumps,
                   'pickle': pickle.dumps}[encoder]
        try:
            b = source.to_dask()
        except NotImplementedError:
            import dask.bag as db
            b = db.from_sequence(source.read(), npartitions=1)
        files = open_files(posixpath.join(path, 'part.*'), mode='wt',
                           num=b.npartitions)
        dwrite = dask.delayed(write_file)
        out = [dwrite(part, f, encoder)
               for part, f in zip(b.to_delayed(), files)]
        dask.compute(out)
        s = TextFilesSource(posixpath.join(path, 'part.*'))
        return s
604730
def save(self, key, data):
        
        self._db[key] = json.dumps(data)
        self._db.sync()
559193
def persist(self, name):
        
        with self.pipe as pipe:
            return pipe.persist(self.redis_key(name))
656205
def store(bank, key, data):
    '''
    
    '''
    c_key = '{0}/{1}'.format(bank, key)
    try:
        c_data = __context__['serial'].dumps(data)
        api.kv.put(c_key, c_data)
    except Exception as exc:
        raise SaltCacheError(
            'There was an error writing the key, {0}: {1}'.format(
                c_key, exc
            )
        )