Exemplo n.º 1
0
 @Override
 public void reloadFaviconCache(CacheBuilderSpec spec) {
   if (spec != null) {
     this.faviconCache = CacheBuilder.from(spec).build(faviconLoader);
   } else {
     // Delete favicon cache
     faviconCache.invalidateAll();
     faviconCache.cleanUp();
     this.faviconCache = null;
   }
 }
 @Override
 public void configure(String id, Properties properties) throws PIPException {
   this.setName(properties.getProperty(id + "." + PROP_NAME, id));
   this.setDescription(properties.getProperty(id + "." + PROP_DESCRIPTION));
   this.setIssuer(properties.getProperty(id + "." + PROP_ISSUER));
   /*
    * Configure the cache IF it is defined
    */
   if (properties.getProperty(id + "." + PROP_CACHESPEC) != null) {
     this.cache = CacheBuilder.from(properties.getProperty(id + "." + PROP_CACHESPEC)).build();
   }
 }
Exemplo n.º 3
0
  /**
   * create a column cache of a matrix
   *
   * @param cacheSpec cache specification
   * @return a matrix column cache
   */
  public LoadingCache<Integer, SparseVector> columnCache(String cacheSpec) {
    LoadingCache<Integer, SparseVector> cache =
        CacheBuilder.from(cacheSpec)
            .build(
                new CacheLoader<Integer, SparseVector>() {

                  @Override
                  public SparseVector load(Integer columnId) throws Exception {
                    return column(columnId);
                  }
                });

    return cache;
  }