2014-04-23 06:24:08 +00:00
|
|
|
from .adapter import CacheControlAdapter
|
|
|
|
from .cache import DictCache
|
|
|
|
from .session import CacheControlSession
|
2014-03-27 21:06:03 +00:00
|
|
|
|
2014-04-23 06:24:08 +00:00
|
|
|
def CacheControl(sess=None, cache=None, cache_etags=True, serializer=None):
|
2014-03-29 04:23:55 +00:00
|
|
|
sess = sess or CacheControlSession()
|
2014-03-27 21:06:03 +00:00
|
|
|
cache = cache or DictCache()
|
2014-04-23 06:24:08 +00:00
|
|
|
adapter = CacheControlAdapter(
|
|
|
|
cache,
|
|
|
|
cache_etags=cache_etags,
|
|
|
|
serializer=serializer,
|
|
|
|
)
|
2014-03-27 21:06:03 +00:00
|
|
|
sess.mount('http://', adapter)
|
2014-04-23 06:24:08 +00:00
|
|
|
sess.mount('https://', adapter)
|
2014-03-27 21:06:03 +00:00
|
|
|
|
|
|
|
return sess
|