Ejemplo n.º 1
0
 // Strategies for removing keys in the presence of a lookup
 // system distributed as cached views. Reference type KeyVals
 // means the caches immediately reflect new vals, but make
 // removal of values trickier.
 // One approach is to flag the KeyVals as obsolete or evacuated,
 // then check this flag on every cached lookup, falling back to
 // a lookup against the backing dictionary which may be accompanied
 // by replacing the evacuated KeyVal. This has the advantage of laziness
 // and avoiding scans or maintaining an index of the location of KeyVals
 // so they can be efficiently removed on their actual removal from the
 // dictionary, but incurs an extra boolean check for every lookup,
 // which may be a bit expensive at this level where we're counting every op,
 // and you'd still have to do a bit of dancing around for an evacuated KeyVal.
 // We're close to having the infrastructure for that though, so it might be
 // a path to explore more in the future.
 // Another approach is to maintain an index of where all the keyvals are.
 // This would make finding and updating them faster, but incur all the overhead,
 // in terms of speed, memory, and code complexity, of maintaining the index itself.
 // We don't want to do that right now.
 // The approach we're going with for the moment is to just scan everything
 // and remove matching KeyVals as soon as their key is deleted, on the premise
 // that it's the simplest thing to do and key deletions are probably pretty rare.
 public void Remove(object k)
 {
     state.Remove((Keyword)k);
     // TODO: consider caching this
     foreach (var x in GetComponents <ArcadiaBehaviour>())
     {
         x.RemoveCachedKey(k);
     }
 }
Ejemplo n.º 2
0
 public void Remove(object k)
 {
     state.Remove(k);
     // don't need to refresh anything
 }