#!/usr/bin/python import json from dbmq import Database db = Database() db.delete('foo')
#!/usr/bin/python from dbmq import Database db = Database() print db.set('foo', 'bar')
#!/usr/bin/python from dbmq import Database db = Database() document = {"foo": "bar", "hello": "world"} db.create('foo', document)
#!/usr/bin/python import time from dbmq import Database db = Database() while True: print db.pop('foo') time.sleep(1)
#!/usr/bin/python from dbmq import Database db = Database() print db.set('foo','bar')
#!/usr/bin/python import json from dbmq import Database db = Database() print(json.dumps(db.read('foo'),indent=2)
#!/usr/bin/python from dbmq import Database db = Database() document = { "foo":"bar", "hello":"world" } db.create('foo',document)
#!/usr/bin/python ## Imports import time import threading from dbmq import Database ## Setup daemon = Database(daemonize=True,linger=100) db = Database(linger=100) ## Test for running workers def workersAlive(workers): still_alive = False for i in workers: if i.isAlive(): still_alive = True return(still_alive) ## Worker thread def worker(id): while running: print('Worker %s is waiting for work'%(str(id))) work = db.pop('work') if work: print('Worker %s got %s'%(id,work)) while not db.push('done',work):
#!/usr/bin/python from dbmq import Database db = Database() document = {"foo": "foobar"} db.update('foo', document)
#!/usr/bin/python import time from dbmq import Database db = Database() while True: print db.get('foo') time.sleep(1)
#!/usr/bin/python from dbmq import Database db = Database() for i in range(0,9) print db.push('foo',i)
#!/usr/bin/python from dbmq import Database db = Database() document = { "foo":"foobar" } db.update('foo',document)
#!/usr/bin/python from dbmq import Database db = Database(daemonize=True)