
from flask import Flask
from werkzeug.contrib.cache import FileSystemCache
import pkg_resources

app=Flask(__name__)
#app.config.from_object('config')

cache=FileSystemCache(pkg_resources.resource_filename('vishwin_http', 'cache'), default_timeout=60 * 60) # one hour timeout

import vishwin_http.views


from flask import Flask
from werkzeug.contrib.cache import MemcachedCache
import pkg_resources

app=Flask(__name__)
app.config.from_object('config')

# set up a memcached Werkzeug cache, prefixing each key, with default timeout of one hour
cache=MemcachedCache(servers=app.config['MEMCACHED_SERVERS'], key_prefix=app.config['MEMCACHED_KEYPREFIX'], default_timeout=60 * 60)

import vishwin_http.views

Switch to memcached cache backend
Switch to memcached cache backend

- Reinstate config file
- Read server locations and key prefix from config

  
  from flask import Flask
- from werkzeug.contrib.cache import FileSystemCache
+ from werkzeug.contrib.cache import MemcachedCache
  import pkg_resources
  
  app=Flask(__name__)
- #app.config.from_object('config')
+ app.config.from_object('config')
  
- cache=FileSystemCache(pkg_resources.resource_filename('vishwin_http', 'cache'), default_timeout=60 * 60) # one hour timeout
+ # set up a memcached Werkzeug cache, prefixing each key, with default timeout of one hour
+ cache=MemcachedCache(servers=app.config['MEMCACHED_SERVERS'], key_prefix=app.config['MEMCACHED_KEYPREFIX'], default_timeout=60 * 60)
  
  import vishwin_http.views
  
Switch to memcached cache backend
## Code Before:

from flask import Flask
from werkzeug.contrib.cache import FileSystemCache
import pkg_resources

app=Flask(__name__)
#app.config.from_object('config')

cache=FileSystemCache(pkg_resources.resource_filename('vishwin_http', 'cache'), default_timeout=60 * 60) # one hour timeout

import vishwin_http.views

## Instruction:
Switch to memcached cache backend
## Code After:

from flask import Flask
from werkzeug.contrib.cache import MemcachedCache
import pkg_resources

app=Flask(__name__)
app.config.from_object('config')

# set up a memcached Werkzeug cache, prefixing each key, with default timeout of one hour
cache=MemcachedCache(servers=app.config['MEMCACHED_SERVERS'], key_prefix=app.config['MEMCACHED_KEYPREFIX'], default_timeout=60 * 60)

import vishwin_http.views
