@classmethod
    @profile
    def get_by_slug(cls, slug):
        L.d('Getting from Cache.')
        obj = cache.get(cls.key(slug))
        if obj:
            L.d('Cache hit for - %s' % cls.key(slug))
            return obj
        L.d('Cache miss for - %s' % cls.key(slug))
        obj = cls.query.filter_by(slug=slug).first()
        if obj:
            L.d('Saving in cache - %s' % cls.key(slug))
            cache.set(cls.key(slug), obj)
        else:
            L.d('The object was None')
        return obj
dataset/ETHPy150Open brijeshb42/yapper/yapper/blueprints/blog/models.py/Post.get_by_slug/original