title: CherryPy Calling a function on session expiry
body: <p>I am using sessions in a webapp and want to have them call a function when they expire. I have read the documentation on sessions in cherryPy (<a href="http://docs.cherrypy.org/en/latest/_modules/cherrypy/lib/sessions.html" rel="nofollow noreferrer">http://docs.cherrypy.org/en/latest/_modules/cherrypy/lib/sessions.html</a>) and am unsure how to achieve this.</p>
  
  <pre><code>class MainApp(object):
      #CherryPy Configuration
      _cp_config = {'tools.encode.on': True, 
                'tools.encode.encoding': 'utf-8',
                'tools.sessions.on' : True,
                'tools.sessions.timeout' : 5 }
  
      def login(self,user):
          cherrypy.session['username'] = username
  
      def doThisWhenSessionExpires()
          db = sqlite3.connect('userData.db')
          db.execute('''UPDATE currentUser set active = "No" where ID=1''')
          db.commit()
  
  if __name__ == '__main__':
      cherrypy.quickstart(root(), '/')
  </code></pre>
  
  <p>Is there a way to achieve this sort of functionality?</p>