def make_cache_queue():
 cache = frappe.cache()
 emails = frappe.db.sql(u"select\n DCTB  DCTB  DCTB name\n DCTB  DCTB from\n DCTB  DCTB  DCTB `tabEmail Queue`\n DCTB  DCTB where\n DCTB  DCTB  DCTB (status='Not Sent' or status='Partially Sent') and\n DCTB  DCTB  DCTB (send_after is null or send_after < %(now)s)\n DCTB  DCTB order\n DCTB  DCTB  DCTB by priority desc, creation asc\n DCTB  DCTB limit 500", {u'now': now_datetime()})
 cache.delete_value(u'cache_email_queue')
 for e in emails:
  cache.rpush(u'cache_email_queue', e[0])

def make_cache_queue ( ) : cache = frappe . cache ( ) emails = frappe . db . sql ( u"select\n DCTB  DCTB  DCTB name\n DCTB  DCTB from\n DCTB  DCTB  DCTB `tabEmail Queue`\n DCTB  DCTB where\n DCTB  DCTB  DCTB (status='Not Sent' or status='Partially Sent') and\n DCTB  DCTB  DCTB (send_after is null or send_after < %(now)s)\n DCTB  DCTB order\n DCTB  DCTB  DCTB by priority desc, creation asc\n DCTB  DCTB limit 500" , { u'now' : now_datetime ( ) } ) cache . delete_value ( u'cache_email_queue' ) for e in emails : cache . rpush ( u'cache_email_queue' , e [ 0 ] )
cache values in queue before sendign .