angular 中
app.controller('controller01',['$scope','$cacheFactory',function($scope,$cacheFactory){ var cache = $cacheFactory('cache01'); cache.put('name','sdsadas'); cache.put('sdsadas','sdsadas'); var name = cache.info(); console.log(name); }]); app.controller('controller02',['$scope','$cacheFactory',function($scope,$cacheFactory){ var cache = $cacheFactory.get('cache01'); var name = cache.get('name'); console.log(name); }]);