当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript service.ICache.put方法代码示例

本文整理汇总了TypeScript中core/cache/deckCache.service.ICache.put方法的典型用法代码示例。如果您正苦于以下问题:TypeScript service.ICache.put方法的具体用法?TypeScript service.ICache.put怎么用?TypeScript service.ICache.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core/cache/deckCache.service.ICache的用法示例。


在下文中一共展示了service.ICache.put方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: removeLastItem

 public removeLastItem(type: string): void {
   const items: IRecentHistoryEntry[] = this.getItems(type);
   if (items.length) {
     items.splice(0, 1);
     this.cache.put(type, items);
   }
 }
开发者ID:brujoand,项目名称:deck,代码行数:7,代码来源:recentHistory.service.ts

示例2: addExtraDataToLatest

 /**
  * Used to include additional fields needed by display formatters that might not be present in $stateParams,
  * but are resolved in a controller when the view loads
  * See instanceDetails.controller.js for an example
  * @param type
  * @param extraData
  */
 public addExtraDataToLatest(type: string, extraData: any): void {
   const items: IRecentHistoryEntry[] = this.getItems(type);
   if (items.length) {
     items[0].extraData = extraData;
     this.cache.put(type, items);
   }
 }
开发者ID:brujoand,项目名称:deck,代码行数:14,代码来源:recentHistory.service.ts

示例3: removeByAppName

 /**
  * Called when deleting an application to remove its record in recent history
  * @param appName
  */
 public removeByAppName(appName: string) {
   const type = 'applications';
   const items: IRecentHistoryEntry[] = this.getItems(type);
   const remaining: IRecentHistoryEntry[] = items.filter((item) => item.params.application !== appName);
   if (remaining) {
     this.cache.put(type, remaining);
   }
 }
开发者ID:brujoand,项目名称:deck,代码行数:12,代码来源:recentHistory.service.ts

示例4: removeItem

  public removeItem(type: string, id: string): void {
    const items: IRecentHistoryEntry[] = this.getItems(type),
          existing: IRecentHistoryEntry = items.find(i => i.id === id);

    if (existing) {
      items.splice(items.indexOf(existing), 1);
      this.cache.put(type, items);
    }
  }
开发者ID:brujoand,项目名称:deck,代码行数:9,代码来源:recentHistory.service.ts

示例5: addItem

 public addItem(type: string, state: string, params: any, keyParams: string[] = []) {
   const items: IRecentHistoryEntry[] = this.getItems(type).slice(0, MAX_ITEMS),
         existing: IRecentHistoryEntry = this.getExisting(items, params, keyParams),
         entry = {
           params: params,
           state: state,
           accessTime: new Date().getTime(),
           extraData: {},
           id: UUIDGenerator.generateUuid(),
         };
   if (existing) {
     items.splice(items.indexOf(existing), 1);
   }
   if (items.length === MAX_ITEMS) {
     items.pop();
   }
   items.push(entry);
   this.cache.put(type, items);
 }
开发者ID:brujoand,项目名称:deck,代码行数:19,代码来源:recentHistory.service.ts

示例6: expect

      cacheInitializer.initialize().then(() => {
        cache = infrastructureCache.get('credentials');
        expect(cache).toBeDefined();
        expect(cache.keys().length).toBe(0);

        const key = 'myTestCacheKey';
        const value = 'myTestCacheValue';
        cache.put(key, value);

        expect(cache.keys().length).toBe(1);
        expect(cache.get(key)).toBe(value);

        cacheInitializer.refreshCache('credentials').then((result: any[]) => {
          expect(flatten(result)).toEqual(keys.account);
          cache = infrastructureCache.get('credentials');
          expect(cache.keys().length).toBe(0);
        });
        initialized = true;
      });
开发者ID:jtk54,项目名称:deck,代码行数:19,代码来源:cacheInitializer.service.spec.ts


注:本文中的core/cache/deckCache.service.ICache.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。