def _document_lock_steal(document_id, user_name, expire_time=(60 * 15)):
 try:
  redis = redis_client(name='default')
  key = _document_lock_key.format(id=document_id)
  it_worked = redis.set(key, user_name)
  redis.expire(key, expire_time)
  return it_worked
 except RedisError as e:
  statsd.incr('redis.errror')
  log.error(('Redis error: %s' % e))
  return False

def _document_lock_steal ( document_id , user_name , expire_time = ( 60 * 15 ) ) : try : redis = redis_client ( name = 'default' ) key = _document_lock_key . format ( id = document_id ) it_worked = redis . set ( key , user_name ) redis . expire ( key , expire_time ) return it_worked except RedisError as e : statsd . incr ( 'redis.errror' ) log . error ( ( 'Redis error: %s' % e ) ) return False
lock a document for a user .