Watch a key.

        :param key: key to watch

        :returns: tuple of ``events_iterator`` and ``cancel``.
                  Use ``events_iterator`` to get the events of key changes
                  and ``cancel`` to cancel the watch request
519375
def watch(self, key, **kwargs):
        
        event_queue = queue.Queue()

        def callback(event):
            event_queue.put(event)

        w = watch.Watcher(self, key, callback, **kwargs)
        canceled = threading.Event()

        def cancel():
            canceled.set()
            event_queue.put(None)
            w.stop()

        def iterator():
            while not canceled.is_set():
                event = event_queue.get()
                if event is None:
                    canceled.set()
                if not canceled.is_set():
                    yield event

        return iterator(), cancel
957740
def get_timemachine_instance(self, key):
        
        modcommit = self._get_modcommit(key)
        if not modcommit: 
            return None
        return TimeMachine(uid = modcommit.value)
396119
def pop(self, key, timeout=1, is_async=False, only_read=False):
        
        if key not in self.cache_items:
            return None
        return self.cache_items.pop(key)[key]
1166108
async def _watch(self, node, conn, names):
        ""
        for name in names:
            slot = self._determine_slot('WATCH', name)
            dist_node = self.connection_pool.get_node_by_slot(slot)
            if node.get('name') != dist_node['name']:
                # raise error if commands in a transaction can not hash to same node
                if len(node) > 0:
                    raise ClusterTransactionError("Keys in request don't hash to the same node")
        if self.explicit_transaction:
            raise RedisError('Cannot issue a WATCH after a MULTI')
        await conn.send_command('WATCH', *names)
        return await conn.read_response()
1340472
def when(self, key):
        
        ctx = Context(key, self)
        self.context.append(ctx)
        return ctx
206371
def watch(self, key, *keys):
        
        # FIXME: we can send watch through one connection and then issue
        #   'multi/exec' command through other.
        # Possible fix:
        #   "Remember" a connection that was used for 'watch' command
        #   and then send 'multi / exec / discard' through it.
        fut = self._pool_or_conn.execute(b'WATCH', key, *keys)
        return wait_ok(fut)
971727
def get(self, key):
        
        o = self.data[key]()
        if o is None:
            # On CPython, the weakref callback will always(?) run before any
            # other code has a chance to observe that the weakref is broken;
            # and since the callback removes the item from the dict, this
            # branch of code should never run. However, on PyPy (and possibly
            # other Python implementations), the weakref callback does not run
            # immediately, thus we may be able to observe this intermediate
            # state. Should this occur, we remove the dict item ourselves,
            # and raise CacheFault (which is a KeyError subclass).
            del self.data[key]
            raise CacheFault(
                "FinalizingCache has %r but its value is no more." % (key,))
        log.msg(interface=iaxiom.IStatEvent, stat_cache_hits=1, key=key)
        return o
446609
def getKey(self, key):
		
		data = self.getDictionary()
		if key in data:
			return data[key]
		else:
			return None
623669
def toggle(self, key):
        
        val = self[key]
        assert isinstance(val, bool), 'key[%r] = %r is not a bool' % (key, val)
        self.pref_update(key, not val)
1222598
def pull(self, key, default=None):
        
        val = self.get(key, default)

        self.forget(key)

        return val
1241461
def start(self, key):
        
        start_d = self._get_limiter(key).start()
        self._cleanup_limiter(key)
        return start_d
1147904
def watch_prefix_once(self, key_prefix, timeout=None, **kwargs):
        
        kwargs['range_end'] = \
            utils.increment_last_byte(utils.to_bytes(key_prefix))
        return self.watch_once(key_prefix, timeout=timeout, **kwargs)
81243
def requestUnOrdered(self, key: str):
        
        now = time.perf_counter()
        if self.acc_monitor:
            self.acc_monitor.update_time(now)
            self.acc_monitor.request_received(key)
        self.requestTracker.start(key, now)
895445
def get(self, key):
        
        group = self.get_node(key)
        if group is None:
            raise KeyError('No object named {key} in the file'.format(key=key))
        return self._read_group(group)
136571
def key_callback(type, key)
      key = key.downcase

      # All key events
      @events[:key].each do |id, e|
        e.call(KeyEvent.new(type, key))
      end

      case type
      # When key is pressed, fired once
      when :down
        @events[:key_down].each do |id, e|
          e.call(KeyEvent.new(type, key))
        end
      # When key is being held down, fired every frame
      when :held
        @events[:key_held].each do |id, e|
          e.call(KeyEvent.new(type, key))
        end
      # When key released, fired once
      when :up
        @events[:key_up].each do |id, e|
          e.call(KeyEvent.new(type, key))
        end
      end
    end
170851
def get(self, key):
        
        data = self._store.get(key)
        if not data:
            return None
        value, expire = data
        if expire and time.time() > expire:
            del self._store[key]
            return None
        return value
246506
@Override
  public void notifyWatch(byte[] key)
  {
    int hash = _table.getPodHash(key);
    
    TablePodNode node = getNode(hash);
    
    if (node.isSelfOwner()) {
      _table.notifyWatch(key);
    }
    else {
      ServerBartender owner = node.getOwner();
      
      ClusterServiceKraken proxy = _podKraken.getProxy(owner.getId());
    
      if (proxy != null) {
        proxy.notifyWatch(_table.getKey(), key);
      }
    }
  }