Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    CustomDataSource lifecycle

    Is smart construct a DataSource object for each request or holds a pool of some?

    I have some heavy initialization part in the constructor which i don`t want to run for each request (and it is defiantly can be shared between requests)
    should i worry about that or not?

    thanks

    #2
    There are pooled, yes, but if you're concerned, you can separately pool or cache whatever data is being computed in your DataSource constructor.

    Comment


      #3
      how do i do that? i mean is there anything like @cache or should i implement by myself?

      Comment


        #4
        I'd really like some more information about this. How long does my custom DataSource object live? Can I modify the lifecycle? Can I do things specifically when my DataSource comes out of the pool?

        I've experimented a little bit, and it seems that a new object is constructed for every request. The cleanup function I use is freeResources(), which I just guessed based on the name.

        Comment

        Working...
        X