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