title: global object access across the session in web2py?
body: <p>I'm new to webdev, these days plan for writing a boradgame with web2py.</p>
  
  <p>When start to coding, I found that I can't use global variables easily. </p>
  
  <p>for demo purpose, I want a python list object access by many players, I use <em>sqlite</em> to make it work.</p>
  
  <p>the database, (using <code>DAL('sqlite:memory:')</code> won't work), so I try the file way, it works as my thought:</p>
  
  <pre><code>memdb = DAL('sqlite://storage.sqlite')
  memdb.define_table('room', Field('card_on_desk', 'blob'))
  </code></pre>
  
  <p>create a room:</p>
  
  <pre><code>roomid = memdb.room.insert(card_on_desk=pickle.dumps(list()))
  memdb.commit()
  </code></pre>
  
  <p>change the room's card_on_desk field:</p>
  
  <pre><code>record = memdb.room(roomid)
  cards = pickle.loads(record.card_on_desk)
  cards.append(','.join(c))
  memdb(memdb.room.id==roomid).update(card_on_desk=pickle.dumps(cards))
  memdb.commit()
  </code></pre>
  
  <p>Some gurus said there is a cache.ram() way, I want to know how to do the above stuff.</p>
  
  <p>wait for your answers.</p>
  
  <p><a href="https://stackoverflow.com/users/10661/s-lott">S.Lott</a> mention that I did not describe what happens when using DAL('sqlite:memory:'):</p>
  
  <p>using <code>sqlite:memory</code> instead of 'sqlite://storage.sqlite', the memdb insert is alright in a http request, but nothing saves, everytime you I call <code>memdb.room.insert()</code> returns the times I called and when the request is finish, nothing saved in memory, memdb.room(1) always return None.</p>
  
  <p><a href="https://stackoverflow.com/users/440323/anthony">Anthony</a>'s advice is more useful, I'll try to use that way, bit hard to do so.</p>