type $cacheFactory.Cache

Posted 发福大叔

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了type $cacheFactory.Cache相关的知识,希望对你有一定的参考价值。

用于存储和检索数据的缓存对象,主要用于http和scipt指令,用于缓存模板和其他数据。

用法:

index.html

<!DOCTYPE html>
<html ng-app="indexApp">
<head lang="en">
    <meta charset="UTF-8">
    <title>BookStore</title>
</head>
<body  ng-controller="firCtrl">
<div>
    <label>msg:<input ng-model="msg" /></label>
    <label>id:<input ng-model="msg.id" /></label>
    <label>size:<input ng-model="msg.size" /></label>
</div>
<script src="framework/angular.js"></script>
<script src="myJs/cache.js"></script>
<script src="myJs/index.js"></script>
</body>
</html>

index.js

angular.module(‘indexApp‘,["superCache"])
    .controller(‘firCtrl‘,[‘$scope‘, ‘smCache‘ ,function($scope, smCache){
        smCache.put("name","drr");
        smCache.put("how","like");
        $scope.msg = smCache.info();
}]);

cache.js

angular.module(‘superCache‘,[])
.factory(‘smCache‘,[‘$cacheFactory‘,function($cacheFactory){
    return $cacheFactory(‘ms‘);
}]);

方法:

put(key, value);

get(key);

remove(key);

remove(key);

destroy();

info(); 返回具有以下属性的对象:id:缓存实例的id,size::缓存实例中保存的条目的数量...在创建缓存时,选项对象中的任何其他属性。

以上是关于type $cacheFactory.Cache的主要内容,如果未能解决你的问题,请参考以下文章

The constructor ClassPathXmlApplicationContext(String) refers to the missing type BeansException(示例代

GO 智能合约cannot use transactionRecordId + strconv.Itoa(id) (type string) as type byte in append(示例代码(代

SpringAOPBean named * is expected to be of type * but was actually of type ‘com.sun.proxy.$Proxy7‘(代

The return type is incompatible with JspSourceDependent.getDependants():JasperException问题分析与解决方法(示例代

PostgreSQL-9.6.3LOG: unrecognized configuration parameter "dynamic_shared_memory_type"((代

Type Status Report Message /$%7BpageContext.request.contextPath%7D/upload.do Description The origi(代