from recommend.models import DeviceInterest
from libs.cache import redis_client

def get_realtime_interest(device_id):
    redis_key = DeviceInterest.get_realtime_interest_key(device_id)
    tag_id = redis_client.get(redis_key)
    try:
        return int(tag_id)
    except:
        return None