/*
CACHE {
uuid: {
clientId: uuid
parentClientId: uuid,
instance: brix
}
}
return {
name: root,
children: [
{
name: moduleId + ',' + clientId,
children: [
{
name
children
}
]
}
]
}
5768
function tree() {
            var result = {
                name: 'root',
                children: []
            }

            function _parseChildren(parentClientId, children) {
                Util.each(CACHE, function(item) {
                    if (item.parentClientId === parentClientId) {
                        children.push({
                            name: item.moduleId + ',' + item.clientId,
                            module: item,
                            children: _parseChildren(item.clientId, [])
                        })
                    }
                })
                return children
            }

            _parseChildren(Constant.ROOT_CLIENT_ID, result.children)

            return result
        }
1320000
function cacheKey () {
    //  get cache id
    var cacheId = stableId({
        args: this.query.args,
        columnsId: this.cache.model.columnsId,
    })
    // create cache key
    return `${this.cache.model.name}:view:select:collection:${cacheId}`
}
716242
function(max) {
      var keys = [],
        cache = {};
      return {
        set: function(key, value) {
          if (keys.length > this.length) {
            delete cache[keys.shift()];
          }
          cache[key] = value;
          keys.push(key);
          return value;
        },
        get: function(key) {
          if (key === undefined) return cache;
          return cache[key];
        },
        length: max,
        len: function() {
          return keys.length;
        }
      };
    }
4141
def uuid(dev=None):
    '''
    

    '''
    try:
        if dev is None:
            # take the only directory in /sys/fs/bcache and return it's basename
            return list(salt.utils.path.os_walk('/sys/fs/bcache/'))[0][1][0]
        else:
            # basename of the /sys/block/{dev}/bcache/cache symlink target
            return os.path.basename(_bcsys(dev, 'cache'))
    except Exception:
        return False
874178
function( binding, rootUuid, trackName ) {

		var bindingsByRoot = this._bindingsByRootAndName,
			bindingByName = bindingsByRoot[ rootUuid ],

			bindings = this._bindings;

		if ( bindingByName === undefined ) {

			bindingByName = {};
			bindingsByRoot[ rootUuid ] = bindingByName;

		}

		bindingByName[ trackName ] = binding;

		binding._cacheIndex = bindings.length;
		bindings.push( binding );

	}
370914
function cacheCollection(settings, cacheModules){
  var self = this;

  /**
   * Initialize cacheCollection given the provided constructor params
   */
  function init(){
    self.caches = [];
    if(isEmpty(cacheModules)){
      log(false, 'No cacheModules array provided--using the default configuration.');
      getDefaultConfiguration();
    }
    else{
      log(false, 'cacheModules array provided--using a custom configuration.');
      getCustomConfiguration();
      if(self.caches.length < 1){
        throw new Exception('NoCacheException', 'No caches were succesfully initialized.');
      }
    }
  }

  /**
   * Adds a nodeCacheModule instance to self.caches if no cacheModules array is provided
   */
  function getDefaultConfiguration(){
    var CModule = require('cache-service-cache-module');
    var cacheModule = new CModule();
    cacheModule = addSettings(cacheModule);
    self.caches.push(cacheModule);
  }

  /**
   * Adds caches that are not 'empty' from the cacheModules array to self.caches
   */
  function getCustomConfiguration(){
    for(var i = 0; i < cacheModules.length; i++){
      var cacheModule = cacheModules[i];
      if(isEmpty(cacheModule)){
        log(true, 'Cache module at index ' + i + ' is \'empty\'.');
        continue;
      }
      cacheModule = addSettings(cacheModule);
      self.caches.push(cacheModule);
    }
  }

  /**
   * Adds cache-service config properties to each cache module
   * @param {object} cacheModule
   * @return {object} cacheModule
   */
  function addSettings(cacheModule){
    cacheModule.nameSpace = settings.nameSpace;
    cacheModule.verbose = settings.verbose;
    return cacheModule;
  }

  /**
   * Checks if a value is "empty"
   * @param {object | string | null | undefined} val
   * @return {boolean}
   */
  function isEmpty (val) {
    return (val === undefined || val === false || val === null ||
      (typeof val === 'object' && Object.keys(val).length === 0));
  }

  /**
   * Instantates an exception to be thrown
   * @param {string} name
   * @param {string} message
   * @return {exception}
   */
  function Exception(name, message){
    this.name = name;
    this.message = message;
  }

  /**
   * Logging utility function
   * @param {boolean} isError
   * @param {string} message
   * @param {object} data
   */
  function log(isError, message, data){
    var indentifier = 'cacheService: ';
    if(self.verbose || isError){
      if(data) {
        console.log(indentifier + message, data);
      } else {
        console.log(indentifier + message);
      }
    }
  }

  init();
}
1073542
function (query) {
            var rootCollection = this.getRoot();

            if (query instanceof Query) {

                var options = _.defaults({}, {
                    query: query,
                    root: rootCollection
                }, rootCollection.$);

                var filterCacheId = query.whereCacheId(),
                    cache = rootCollection.$filterCache;

                if (filterCacheId) {
                    if (!cache[filterCacheId]) {
                        cache[filterCacheId] = this._createFilteredCollection(query, options);
                    }

                    return cache[filterCacheId];
                }

            }

            return rootCollection;
        }
451393
public Set<Type> getChildTypes()
        throws CacheReloadException
    {
        final Set<Type> ret = new HashSet<>();
        for (final Long id : this.childTypes) {
            final Type child = Type.get(id);
            ret.add(child);
            ret.addAll(child.getChildTypes());
        }
        return Collections.unmodifiableSet(ret);
    }
1044837
function getRootId(node) {
    var ancestor = node;
    while (ancestor.depth > 1) {
        ancestor = ancestor.parentNode;
    }

    var virtualRoot = node.getAncestors()[0];
    return zrUtil.indexOf(virtualRoot.children, ancestor);
}
611213
function get(sessionId, cb) {
        has(sessionId, (hasId) => {
            if (hasId) {
                cb(sessionIdCache[sessionId]);
            }
            else {
                cb();
            }
        });
    }
610340
@Override
    public Set<IGroupMember> getChildren() throws GroupsException {

        final EntityIdentifier cacheKey = getUnderlyingEntityIdentifier();
        Element element = childrenCache.get(cacheKey);

        if (element == null) {
            final Set<IGroupMember> children = buildChildrenSet();
            element = new Element(cacheKey, children);
            childrenCache.put(element);
        }

        @SuppressWarnings("unchecked")
        final Set<IGroupMember> rslt = (Set<IGroupMember>) element.getObjectValue();
        return rslt;
    }
638148
def list_cache_nodes_full(opts=None, provider=None, base=None):
    '''
    
    '''
    if opts is None:
        opts = __opts__
    if opts.get('update_cachedir', False) is False:
        return

    if base is None:
        base = os.path.join(opts['cachedir'], 'active')

    minions = {}
    # First, get a list of all drivers in use
    for driver in os.listdir(base):
        minions[driver] = {}
        prov_dir = os.path.join(base, driver)
        # Then, get a list of all providers per driver
        for prov in os.listdir(prov_dir):
            # If a specific provider is requested, filter out everyone else
            if provider and provider != prov:
                continue
            minions[driver][prov] = {}
            min_dir = os.path.join(prov_dir, prov)
            # Get a list of all nodes per provider
            for fname in os.listdir(min_dir):
                # Finally, get a list of full minion data
                fpath = os.path.join(min_dir, fname)
                minion_id = fname[:-2]  # strip '.p' from end of msgpack filename
                mode = 'rb' if six.PY3 else 'r'
                with salt.utils.files.fopen(fpath, mode) as fh_:
                    minions[driver][prov][minion_id] = salt.utils.data.decode(
                        salt.utils.msgpack.load(fh_, encoding=MSGPACK_ENCODING))

    return minions
107208
function(plugins) {
		var p = this._plugins;
		([]).concat(plugins).forEach(function(plugin) {
			if (p.indexOf(plugin) === -1) {
				p.push(plugin);
			}
		});

		this._cacheId++;
	}
84043
def getAllNodeUids(self):
        '''
            
        '''
        # Start with a set including this tag's uuid
        ret = { self.uid }

        ret.update(self.getAllChildNodeUids())

        return ret
67420
public CmsContainerElementData getCachedElement(String clientId) {

        if (m_elements.containsKey(clientId)) {
            return m_elements.get(clientId);
        }
        return null;
    }
697428
function instantiateChildren(nestedChildNodes, transaction, context, selfDebugID) // 0 in production and for roots
  {
    if (nestedChildNodes == null) {
      return null;
    }
    var childInstances = {};

    if (false) {
      traverseAllChildren(nestedChildNodes, function (childInsts, child, name) {
        return instantiateChild(childInsts, child, name, selfDebugID);
      }, childInstances);
    } else {
      traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
    }
    return childInstances;
  }
83263
function buildElastiCacheSubnetGroup(numZones = 0, { name = 'ElastiCacheSubnetGroup' } = {}) {
  if (numZones < 1) {
    return {};
  }

  const subnetIds = [];
  for (let i = 1; i <= numZones; i += 1) {
    subnetIds.push({ Ref: `${DB_SUBNET}Subnet${i}` });
  }

  return {
    [name]: {
      Type: 'AWS::ElastiCache::SubnetGroup',
      Properties: {
        CacheSubnetGroupName: {
          Ref: 'AWS::StackName',
        },
        Description: {
          Ref: 'AWS::StackName',
        },
        SubnetIds: subnetIds,
      },
    },
  };
}