customise write cache interval and cache size.

@param initDelay - initial interval before write cache is checked
@param delayCache - interval (ms) to check write cache
@param cacheSize - size (# triples) of write cache
170349
@Override
    public void configureWriteCache(long initDelay, long delayCache, long cacheSize){
        client.initTimer(initDelay, delayCache,cacheSize);
    }
559304
public void init() {
		if (initDepth.get() == null) {
			initDepth.set(1);
		} else {
			initDepth.set(initDepth.get() + 1);
		}

		if (resourceCache.get() == null) {
			resourceCache.set(new HashMap<String, Object>());
		}

		if (cacheLocked.get() == null) {
			cacheLocked.set(Boolean.FALSE);
		}
	}
368046
public static void scheduleWithFixedDelay(
      final ScheduledExecutorService exec,
      final Duration initialDelay,
      final Duration delay,
      final Callable<Signal> callable
  )
  {
    log.debug("Scheduling repeatedly: %s with delay %s", callable, delay);
    exec.schedule(
        new Runnable()
        {
          @Override
          public void run()
          {
            try {
              log.debug("Running %s (delay %s)", callable, delay);
              if (callable.call() == Signal.REPEAT) {
                log.debug("Rescheduling %s (delay %s)", callable, delay);
                exec.schedule(this, delay.getMillis(), TimeUnit.MILLISECONDS);
              } else {
                log.debug("Stopped rescheduling %s (delay %s)", callable, delay);
              }
            }
            catch (Throwable e) {
              log.error(e, "Uncaught exception.");
            }
          }
        },
        initialDelay.getMillis(),
        TimeUnit.MILLISECONDS
    );
  }
1115830
public void initTimer(){
		stopTimer();
		if(this.WRITE_CACHE_ENABLED) {
			logger.debug("configuring write cache with defaults");
			timerWriteCache = new TripleWriteCache(this);
			writeTimer = new Timer();
			writeTimer.scheduleAtFixedRate(timerWriteCache, TripleWriteCache.DEFAULT_INITIAL_DELAY, TripleWriteCache.DEFAULT_CACHE_MILLIS);
		}
		if(this.DELETE_CACHE_ENABLED) {
			logger.debug("configuring delete cache with defaults");
			timerDeleteCache = new TripleDeleteCache(this);
			deleteTimer = new Timer();
			deleteTimer.scheduleAtFixedRate(timerDeleteCache, TripleDeleteCache.DEFAULT_INITIAL_DELAY, TripleDeleteCache.DEFAULT_CACHE_MILLIS);
		}
	}
422926
public static void scheduleWithFixedDelay(
      final ScheduledExecutorService exec,
      final Duration initialDelay,
      final Duration delay,
      final Runnable runnable
  )
  {
    scheduleWithFixedDelay(
        exec,
        initialDelay,
        delay,
        new Callable<Signal>()
        {
          @Override
          public Signal call()
          {
            runnable.run(); // (Exceptions are handled for us)
            return Signal.REPEAT;
          }
        }
    );
  }
1012773
private void writeBytesSlow(final byte[] bytes, int off, int len)
    {
        while (len > 0)
        {
            final Block block = current;
            final int amount = Math.min(len, block.remaining());
            System.arraycopy(bytes, off, block.data, block.limit, amount);
            block.limit += amount;
            off += amount;
            len -= amount;
            if (block.remaining() == 0)
            {
                if (index == blocks.size() - 1)
                {
                    allocateNewBlock();
                }
                index++;
                current = blocks.get(index);
            }
        }

    }
990174
public void registerFlushDelay (Class<?> objclass, long delay)
    {
        _delays.put(objclass, Long.valueOf(delay));
    }
205149
public T withDelay(TimeUnit timeUnit, long value) {
        this.delay = new Delay(timeUnit, value);
        return (T) this;
    }
64350
public static void setMainCache(String cacheName) {
		if (StrKit.isBlank(cacheName))
			throw new IllegalArgumentException("cacheName can not be blank");
		cacheName = cacheName.trim();
		Cache cache = cacheMap.get(cacheName);
		if (cache == null)
			throw new IllegalArgumentException("the cache not exists: " + cacheName);
		
		Redis.mainCache = cache;
	}
1034556
public void onCacheHit(String template, int locality) {
        final String methodName = "onCacheHit()";

        CacheStatsModule csm = null;
        if ((csm = getCSM(template)) == null) {
            return;
        }
        if (tc.isDebugEnabled())
            Tr.debug(tc, methodName + " cacheName=" + _sCacheName + " template=" + template + " locality=" + locality + " enable=" + csm._enable
                    + " parentEnable=" + _enable + " " + this);

        switch (locality) {
        case REMOTE:
            if (csm._enable) {
                if (csm._remoteHitCount != null) {
                    csm._remoteHitCount.increment();
                }
                if (csm._inMemoryAndDiskCacheEntryCount != null) {
                    csm._inMemoryAndDiskCacheEntryCount.increment();
                }
                if (csm._remoteCreationCount != null) {
                    csm._remoteCreationCount.increment();
                }
            }
            break;
        case MEMORY:
            if (csm._enable && csm._hitsInMemoryCount != null)
                csm._hitsInMemoryCount.increment();
            break;
        case DISK:
            if (_csmDisk != null && _csmDisk._enable && _csmDisk._hitsOnDisk != null) {
                _csmDisk._hitsOnDisk.increment();
            }
            if (csm._enable && csm._hitsOnDiskCount != null)
                csm._hitsOnDiskCount.increment();
            break;
        default:
            if (tc.isDebugEnabled())
                Tr.debug(tc, methodName + " Error - Unrecognized locality " + locality + " cacheName=" + _sCacheName);
            break;
        }
        return;
    }
236632
@Override
	public void init(Key key, IvParameterSpec iv) throws InvalidKeyException {
		if(!(key instanceof SecretKey))
			throw new InvalidKeyException();
		int ivLength = iv.getIV().length;
		if(key.getEncoded().length < MIN_KEY_SIZE || key.getEncoded().length < ivLength)
			throw new InvalidKeyException("Key must be longer than " + MIN_KEY_SIZE + " bytes and key must be longer than IV.");
		this.key = key.getEncoded();
		this.iv = iv;
		prehash = Misc.XORintoA(this.key.length == ivLength ? iv.getIV() : Arrays.copyOf(iv.getIV(), this.key.length), this.key);
		blockNo = 0;
		buffer = new ByteQueue(getBlockSize()*2);
		buffer.setResizable(true);
		cfg = true;
	}
770957
function(fnc, cacheId, delay, scope, parameters, strategy) {
            var self = this,
                LOOP = "loop";

            if (!fnc) {
                return;
            }

            cacheId = cacheId || fnc.toString();
            scope = scope || this;
            parameters = parameters || [];
            strategy = strategy || LOOP;

            if (delay === 0) {
                // immediately invoke function
                fnc.apply(scope, parameters);
                return;
            }

            delay = delay || 300;
            if (this.$debounceTimeoutMap[cacheId]) {
                // timer registered

                if (strategy === LOOP) {
                    return;
                }

                clearTimeout(this.$debounceTimeoutMap[cacheId]);
            }

            this.$debounceTimeoutMap[cacheId] = setTimeout(function() {
                delete self.$debounceTimeoutMap[cacheId];
                fnc.apply(scope, parameters);
            }, delay);
        }
1240262
public void copy(CacheEntry cacheEntry) {

        if (cacheEntry == this)
            return;

        if (useByteBuffer && this.value != null) {
            if (this.value instanceof DistributedNioMapObject) {
                ((DistributedNioMapObject) this.value).release();
            }
        }

        this.value = cacheEntry.value;
        this.valueHashcode = cacheEntry.valueHashcode;
        this.serializedValue = cacheEntry.serializedValue;
        this.serializedId = cacheEntry.serializedId;
        timeStamp = cacheEntry.timeStamp;
        expirationTime = cacheEntry.expirationTime;
        validatorExpirationTime = cacheEntry.validatorExpirationTime;
        timeLimit = cacheEntry.timeLimit;
        inactivity = cacheEntry.inactivity;
        drsClock = cacheEntry.drsClock;
        id = cacheEntry.id;
        priority = cacheEntry.priority;
        if (priority < 0)
            priority = 0;
        if (priority > CacheConfig.MAX_PRIORITY)
            priority = CacheConfig.MAX_PRIORITY;
        _templates = cacheEntry._templates;
        _dataIds = cacheEntry._dataIds;
        _serializedDataIds = cacheEntry._serializedDataIds;
        sharingPolicy = cacheEntry.sharingPolicy;
        persistToDisk = cacheEntry.persistToDisk;
        refCount = new AtomicInteger(cacheEntry.refCount.get());
        aliasList = cacheEntry.aliasList;
        serializedAliasList = cacheEntry.serializedAliasList;
        useByteBuffer = cacheEntry.useByteBuffer;
        userMetaData = cacheEntry.userMetaData;
        serializedUserMetaData = cacheEntry.serializedUserMetaData;
        loadedFromDisk = cacheEntry.loadedFromDisk;
        cacheType = cacheEntry.cacheType;
        skipValueSerialized = cacheEntry.skipValueSerialized;
        skipMemoryAndWriteToDisk = cacheEntry.skipMemoryAndWriteToDisk;
        skipMemoryAndWriteToDiskErrorCode = cacheEntry.skipMemoryAndWriteToDiskErrorCode;
        vbcSource = cacheEntry.vbcSource;
        externalCacheGroupId = cacheEntry.externalCacheGroupId;
        //Note: clock is not set here because it's really owned
        //by the cache.  Only the cache should say when the clock
        //changes.  It makes the cache code more readable.
    }
1087825
@Override
    public int size(boolean includeDiskCache) {
        int mappings = 0;

        mappings = cache.getNumberCacheEntries();

        if (includeDiskCache) {
            if (cache instanceof CacheProviderWrapper) {
                CacheProviderWrapper cpw = (CacheProviderWrapper) cache;
                if (cpw.featureSupport.isDiskCacheSupported())
                    mappings = mappings + cache.getIdsSizeDisk();
            } else {
                mappings = mappings + cache.getIdsSizeDisk();
            }
        }
        return mappings;
    }
433317
public static void setTextSize(EfficientCacheView cacheView, int viewId, float size) {
        View view = cacheView.findViewByIdEfficient(viewId);
        if (view instanceof TextView) {
            ((TextView) view).setTextSize(size);
        }
    }
448144
public void setAcquireRetryDelay(long acquireRetryDelay, TimeUnit timeUnit) {
		this.acquireRetryDelayInMs = TimeUnit.MILLISECONDS.convert(acquireRetryDelay, timeUnit);
	}
1194724
public void scheduleBlockReceivedAndDeleted(long delay) {
    if (delay > 0) {
      lastDeletedReport = System.currentTimeMillis()
          - anode.deletedReportInterval + delay;
    } else {
      lastDeletedReport = 0;
    }
  }