1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef RESOURCECACHEMANAGER_H_
22 #define RESOURCECACHEMANAGER_H_
27 #include "OCPlatform.h"
28 #include "CacheTypes.h"
29 #include "DataCache.h"
31 #define CACHE_TAG PCF("CACHE")
33 class ResourceCacheManager
36 ResourceCacheManager * getInstance();
38 CacheID requestResourceCache(
39 PrimitiveResource & pResource,
40 CacheCB func = NULL, REPORT_FREQUENCY rf = REPORT_FREQUENCY::NONE, long time = 0l);
42 // OCStackResult cancelResourceCache(std::string address, std::string uri);
43 OCStackResult cancelResourceCache(PrimitiveResource & pResource, CacheID id);
45 // OCStackResult updateResourceCache(std::string address, std::string uri);
46 OCStackResult updateResourceCache(PrimitiveResource & pResource);
48 // OCStackResult getResourceCache(std::string address, std::string uri);
49 OCStackResult getResourceCache(PrimitiveResource & pResource);
52 ResourceCacheManager();
53 ~ResourceCacheManager();
55 static ResourceCacheManager * s_instance;
56 static std::mutex s_mutexForCreation;
57 static std::list< DataCache * > * s_cacheDataList;
59 DataCache * findCacheHandler(PrimitiveResource & pResource);
62 #endif /* RESOURCECACHEMANAGER_H_ */