Package googleapiclient :: Package discovery_cache :: Module base
[hide private]
[frames] | no frames]

Source Code for Module googleapiclient.discovery_cache.base

 1  # Copyright 2014 Google Inc. All Rights Reserved. 
 2  # 
 3  # Licensed under the Apache License, Version 2.0 (the "License"); 
 4  # you may not use this file except in compliance with the License. 
 5  # You may obtain a copy of the License at 
 6  # 
 7  #      http://www.apache.org/licenses/LICENSE-2.0 
 8  # 
 9  # Unless required by applicable law or agreed to in writing, software 
10  # distributed under the License is distributed on an "AS IS" BASIS, 
11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
12  # See the License for the specific language governing permissions and 
13  # limitations under the License. 
14   
15  """An abstract class for caching the discovery document.""" 
16   
17  import abc 
18 19 20 -class Cache(object):
21 """A base abstract cache class.""" 22 __metaclass__ = abc.ABCMeta 23 24 @abc.abstractmethod
25 - def get(self, url):
26 """Gets the content from the memcache with a given key. 27 28 Args: 29 url: string, the key for the cache. 30 31 Returns: 32 object, the value in the cache for the given key, or None if the key is 33 not in the cache. 34 """ 35 raise NotImplementedError()
36 37 @abc.abstractmethod
38 - def set(self, url, content):
39 """Sets the given key and content in the cache. 40 41 Args: 42 url: string, the key for the cache. 43 content: string, the discovery document. 44 """ 45 raise NotImplementedError()
46