Helper functions for IndexedDB management.
 
Persists the subscription object in IndexedDB.
12267
function persistSubscriptionLocally(subscription) {
    let subscriptionJSON = JSON.stringify(subscription);
    idb.open('web-push-db', 1).then(db => {
        let tx = db.transaction(['web-push-subcription'], 'readwrite');
        tx.objectStore('web-push-subcription').put({
            id: 1,
            data: subscriptionJSON
        });
        return tx.complete;
    });
}
649466
private <T> void manageSubscription(EventStream<T> stream, Consumer<T> consumer) {
        manageSubscription(stream.subscribe(consumer));
    }
225189
public static void removeSubscription(Subscription subscription) {
        mSubscriptions.remove(subscription);
        LiveQueryClient.executeQuery(subscription.getQuery().unsubscribeQueryToString());
    }
1211950
def persist(self, name, project=None, drop_model=False, **kwargs):
        
        return super(ODPSModelExpr, self).persist(name, project=project, drop_model=drop_model, **kwargs)
1121761
def save
      __robject.content_type = model.content_type
      __robject.data = __persist_attributes

      __check_unique_indices
      __update_indices
      __robject.store

      @id = __robject.key

      self
    end
614528
private void storeWithSubscribers(final List<LogLineTableEntity> lines)
	{
		synchronized (subscribers)
		{
			if (subscribers.isEmpty())
				return; // No subscribers, ignore call

			for (LogSubscriber subscriber : subscribers)
			{
				subscriber.append(lines);
			}

			if (System.currentTimeMillis() > nextSubscriberPurge)
			{
				purgeIdleSubscribers();

				nextSubscriberPurge = System.currentTimeMillis() + purgeSubscriberInterval.getMilliseconds();
			}
		}
	}
1100603
public function persist(): void
    {
        if (!\file_put_contents($this->indexFilepath, \serialize($this->index), LOCK_EX)) {
            throw new IndexException('Unable to persist index to file: '.$this->indexFilepath); // @codeCoverageIgnore
        }
        $this->status = IndexInterface::STATUS_LOADED;
    }
554441
def save(self):
        '''  '''
        redis = type(self).get_redis()
        pipe = to_pipeline(redis)

        pipe.hset(self.key(), 'id', self.id)

        for fieldname, field in self.proxy:
            if not isinstance(field, Relation):
                field.save(getattr(self, fieldname), pipe, commit=False)

        pipe.sadd(type(self).members_key(), self.id)

        pipe.execute()

        if self.notify:
            data = json.dumps({
                'event': 'create' if not self._persisted else 'update',
                'data': self.to_json(),
            })
            redis.publish(type(self).cls_key(), data)
            redis.publish(self.key(), data)

        self._persisted = True

        return self
1361586
public void store(Object obj) throws PersistenceBrokerException
    {
        obj = extractObjectToStore(obj);
        // only do something if obj != null
        if(obj == null) return;

        ClassDescriptor cld = getClassDescriptor(obj.getClass());
        /*
        if one of the PK fields was null, we assume the objects
        was new and needs insert
        */
        boolean insert = serviceBrokerHelper().hasNullPKField(cld, obj);
        Identity oid = serviceIdentity().buildIdentity(cld, obj);
        /*
        if PK values are set, lookup cache or db to see whether object
        needs insert or update
        */
        if (!insert)
        {
            insert = objectCache.lookup(oid) == null
                && !serviceBrokerHelper().doesExist(cld, oid, obj);
        }
        store(obj, oid, cld, insert);
    }
683180
def save(self, obj):
        """"""
        if not obj.id:
            obj.id = uuid()

        index_names = obj.__class__.index_names() or []
        index_dict = obj.indexes() or {}
        index_name_values = [
            (key, index_dict.get(key, ''))
            for key in index_names
        ]

        write_rec(
            obj.__class__.get_table_name(),
            obj.id,
            obj.to_data(),
            index_name_values
        )
947839
function restartSubscription (sub) {
    // Only restart the subscription if it isn't still in ddp's queue.
    if (!sub.stillInQueue) {
        // Handlers to ddp's connected event are invoked asynchronously (see
        // https://github.com/mondora/ddp.js/blob/master/src/ddp.js#L20).
        // Therefore there is a (very very small) chance that between the time
        // when the connected message is received and the time when the
        // connected handler is invoked, the ddp instance disconnected.
        // Therefore we update the stillInQueue status fo the subscription
        this.ddp.sub(sub.name, sub.params, sub.id);
        sub.stillInQueue = (this.ddp.status !== "connected");
    } else {
        // Since we're restarting subscriptions after a connection, we know
        // that now the subscriptions which were in ddp's queue will be sent,
        // therefore we need to remove the stillInQueue flag from them
        sub.stillInQueue = false;
    }
}
27640
def _persist(self):
        """"""
        with open(self.file, 'w') as f:
            json.dump({
                'client': self.client,
                'creds': self.creds,
                'config': self.config
            }, f)
1205292
def save(self, *args, **kwargs):
        
        if not self.instance.id:
            self.instance.created_by = self.user
        self.instance.last_modified_by = self.user
        return super(ChangeableContentForm, self).save(*args, **kwargs)
833968
def persist(self, key, value):
        
        encoded = self.encoding.encode(value)
        self.__set_or_create(key, encoded)
        self.__increment_last_updated()
514231
def _subscribe(self):
        
        _LOGGER.info("PubNub subscribing")
        self._pubnub.subscribe().channels(CHANNELS).execute()
        if self._keep_alive_function is not None:
            threading.Timer(self._keep_alive, self._run_keep_alive).start()
        self._subscribed = True
721446
def process_subscription_data(post_data):
    """"""
    subscription_data = post_data.pop("subscription", {})
    # As our database saves the auth and p256dh key in separate field,
    # we need to refactor it and insert the auth and p256dh keys in the same dictionary
    keys = subscription_data.pop("keys", {})
    subscription_data.update(keys)
    # Insert the browser name
    subscription_data["browser"] = post_data.pop("browser")
    return subscription_data
430383
def save_aggregate(aggregate, concurrency: :none)
      changeset = aggregate.changeset
      events = changeset.events.map { |event| event.with_metadata(namespace: @namespace) }
      revision = aggregate.revision if concurrency == :optimistic
      stream(aggregate.class, changeset.aggregate_id).write_events(events, revision: revision)
      notify_subscribers(changeset.aggregate_id, events)
    end