Diff the bookmark cache and the new bookmark state, emit signals as
        needed and set the bookmark cache to the new data.
778927
def _diff_emit_update(self, new_bookmarks):
        

        self.logger.debug("diffing %s, %s", self._bookmark_cache,
                          new_bookmarks)

        def subdivide(level, old, new):
            """
            Subdivide the bookmarks according to the data item
            ``bookmark.secondary[level]`` and emit the appropriate
            events.
            """
            if len(old) == len(new) == 1:
                old_entry = old.pop()
                new_entry = new.pop()
                if old_entry == new_entry:
                    pass
                else:
                    self.on_bookmark_changed(old_entry, new_entry)
                return ([], [])

            elif len(old) == 0:
                return ([], new)

            elif len(new) == 0:
                return (old, [])

            else:
                try:
                    groups = {}
                    for entry in old:
                        group = groups.setdefault(
                            entry.secondary[level],
                            ([], [])
                        )
                        group[0].append(entry)

                    for entry in new:
                        group = groups.setdefault(
                            entry.secondary[level],
                            ([], [])
                        )
                        group[1].append(entry)
                except IndexError:
                    # the classification is exhausted, this means
                    # all entries in this bin are equal by the
                    # defininition of bookmark equivalence!
                    common = min(len(old), len(new))
                    assert old[:common] == new[:common]
                    return (old[common:], new[common:])

                old_unhandled, new_unhandled = [], []
                for old, new in groups.values():
                    unhandled = subdivide(level+1, old, new)
                    old_unhandled += unhandled[0]
                    new_unhandled += unhandled[1]

                # match up unhandleds as changes as early as possible
                i = -1
                for i, (old_entry, new_entry) in enumerate(
                        zip(old_unhandled, new_unhandled)):
                    self.logger.debug("changed %s -> %s", old_entry, new_entry)
                    self.on_bookmark_changed(old_entry, new_entry)
                i += 1
                return old_unhandled[i:], new_unhandled[i:]

        # group the bookmarks into groups whose elements may transform
        # among one another by on_bookmark_changed events. This information
        # is given by the type of the bookmark and the .primary property
        changable_groups = {}

        for item in self._bookmark_cache:
            group = changable_groups.setdefault(
                (type(item), item.primary),
                ([], [])
            )
            group[0].append(item)

        for item in new_bookmarks:
            group = changable_groups.setdefault(
                (type(item), item.primary),
                ([], [])
            )
            group[1].append(item)

        for old, new in changable_groups.values():

            # the first branches are fast paths which should catch
            # most cases – especially all cases where each bare jid of
            # a conference bookmark or each url of an url bookmark is
            # only used in one bookmark
            if len(old) == len(new) == 1:
                old_entry = old.pop()
                new_entry = new.pop()
                if old_entry == new_entry:
                    # the bookmark is unchanged, do not emit an event
                    pass
                else:
                    self.logger.debug("changed %s -> %s", old_entry, new_entry)
                    self.on_bookmark_changed(old_entry, new_entry)
            elif len(new) == 0:
                for removed in old:
                    self.logger.debug("removed %s", removed)
                    self.on_bookmark_removed(removed)
            elif len(old) == 0:
                for added in new:
                    self.logger.debug("added %s", added)
                    self.on_bookmark_added(added)
            else:
                old, new = subdivide(0, old, new)

                assert len(old) == 0 or len(new) == 0

                for removed in old:
                    self.logger.debug("removed %s", removed)
                    self.on_bookmark_removed(removed)

                for added in new:
                    self.logger.debug("added %s", added)
                    self.on_bookmark_added(added)

        self._bookmark_cache = new_bookmarks
817465
def setModified( self, state = True ):
        
        if ( state == self._modified ):
            return
            
        self._modified = state
        self.emitModifiedStateChanged()
651208
public void
setCache(Cache cache) {
	if (cache == null) {
		this.cache = new Cache(dclass);
		this.temporary_cache = true;
	} else {
		this.cache = cache;
		this.temporary_cache = false;
	}
}
1368636
def do_api_calls_update_cache(self):
        '''  '''
        zones = self.parse_env_zones()
        data = self.group_instances(zones)
        self.cache.write_to_cache(data)
        self.inventory = data
791735
def bookmark_present(name, snapshot):
    '''
    

    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': ''}

    ## log configuration
    log.debug('zfs.bookmark_present::%s::config::snapshot = %s',
              name, snapshot)

    ## check we have valid snapshot/bookmark name
    if not __utils__['zfs.is_snapshot'](snapshot):
        ret['result'] = False
        ret['comment'] = 'invalid snapshot name: {0}'.format(name)
        return ret

    if '#' not in name and '/' not in name:
        ## NOTE: simple snapshot name
        #        take the snapshot name and replace the snapshot but with the simple name
        #        e.g. pool/fs@snap + bm --> pool/fs#bm
        name = '{0}#{1}'.format(snapshot[:snapshot.index('@')], name)
        ret['name'] = name

    if not __utils__['zfs.is_bookmark'](name):
        ret['result'] = False
        ret['comment'] = 'invalid bookmark name: {0}'.format(name)
        return ret

    ## ensure bookmark exists
    if not __salt__['zfs.exists'](name, **{'type': 'bookmark'}):
        ## NOTE: bookmark the snapshot
        if not __opts__['test']:
            mod_res = __salt__['zfs.bookmark'](snapshot, name)
        else:
            mod_res = OrderedDict([('bookmarked', True)])

        ret['result'] = mod_res['bookmarked']
        if ret['result']:
            ret['changes'][name] = snapshot
            ret['comment'] = '{0} bookmarked as {1}'.format(snapshot, name)
        else:
            ret['comment'] = 'failed to bookmark {0}'.format(snapshot)
            if 'error' in mod_res:
                ret['comment'] = mod_res['error']
    else:
        ## NOTE: bookmark already exists
        ret['comment'] = 'bookmark is present'

    return ret
823741
private void updatedCache(final ClassLoader classLoader, final Set<TraceeBackendProvider> provider) {
		final Map<ClassLoader, Set<TraceeBackendProvider>> copyOnWriteMap = new WeakHashMap<>(providersPerClassloader);
		if (!provider.isEmpty()) {
			copyOnWriteMap.put(classLoader, new BackendProviderSet(provider));
		} else {
			copyOnWriteMap.put(classLoader, new EmptyBackendProviderSet());
		}
		providersPerClassloader = copyOnWriteMap;
	}
1314506
function(newValue, oldValue, batchNum) {
                    setCached(newValue);
                    updateOnChange(computed, newValue, oldValue, batchNum);
                }
873695
def update_dev_cache(self, device, data):
        """"""
        self.update_cache(
            {
                CONST.DEVICES: {
                    device.device_id: data
                }
            })
547891
private void updateDetail(TrackMetadataUpdate update, WaveformDetail detail) {
        detailHotCache.put(DeckReference.getDeckReference(update.player, 0), detail);  // Main deck
        if (update.metadata.getCueList() != null) {  // Update the cache with any hot cues in this track as well
            for (CueList.Entry entry : update.metadata.getCueList().entries) {
                if (entry.hotCueNumber != 0) {
                    detailHotCache.put(DeckReference.getDeckReference(update.player, entry.hotCueNumber), detail);
                }
            }
        }
        deliverWaveformDetailUpdate(update.player, detail);
    }
610049
def set_cache(self, value):
        
        value.update(self.cache)
        return self.cache_backend.set(self.cache_key, value)
272977
function set($key, $data)
    {
        $this->cache[$key]         = $data;
        $this->cache_changes[$key] = true;
    }
275588
def cache_data(datatable, data, **kwargs):
    
    cache_key = '%s%s' % (CACHE_PREFIX, datatable.get_cache_key(**kwargs))
    log.debug("Setting data to cache at %r: %r", cache_key, data)
    cache.set(cache_key, data)
227704
def set_mark(self):
        """"""
        self._bookmarks.append(self._offset)
        return len(self._bookmarks) - 1
831885
def update(self, other):
        """"""
        if isinstance(other, cookielib.CookieJar):
            for cookie in other:
                self.set_cookie(copy.copy(cookie))
        else:
            super(RequestsCookieJar, self).update(other)
105218
def emit(signal, *args, **kwargs):
    
    for callback in set(receivers[signal]):  # Make a copy in case of any ninja signals
        _call(callback, args=args, kwargs=kwargs)
1009820
public void broadcastStaleCacheData (String cache, Streamable data)
    {
        _nodeobj.setCacheData(new NodeObject.CacheData(cache, data));
    }
630452
function () {
		var updateCache = this.cache;
		for (var i = 0, n = updateCache.length; i < n; i++)
			updateCache[i].update();
	}