0

I wonder if there is a chance to cache column_property using dogpile.

This is my code:

A.some_count = column_property(
  select([func.count()])
    .where(and_(B.__table__.c.a_id == A.__table__.c.id,
                B.__table__.c.c_id == C.__table__.c.id))  
    .correlate(A.__table__, C.__table__)
    .as_scalar()
    .label('some_count'),
  deferred=True)

Do anybody know how to do that? Any kind of caching would be good either with time stamp or invalidate.

Thank you for help.

Rogalek
  • 50
  • 10
  • Do you mean you'd like to cache the property so that subsequent fetches are avoided after expiring or for new instances of `A` having the same identity? – Ilja Everilä Nov 23 '18 at 10:21
  • I would like to cache this property per instance of class A @IljaEverilä – Rogalek Nov 23 '18 at 13:43
  • But an instance already keeps the value around, once fetched. – Ilja Everilä Nov 23 '18 at 15:10
  • @IljaEverilä I think you don't understand me. So imagine situation that I have web application and I want cache this property in dogpile, because I don't want to query it, every time when I reload a page. For example cache it and reload every 1 hour. Is it possible? – Rogalek Nov 28 '18 at 13:36

0 Answers0