lundi 29 juin 2020

Service in front of session/cache design pattern

We have a series of model objects that are stored on a user's Session (although you could think of this as any cache). And we have a series of 'services' sitting in front of those that act as interfaces to them. So for example say Address was one of the things we stored. We would have an address based service in front that would expose getAddress(), and would check the session for if it exists. If it exists it just returns it, if it doesn't exist it would go fetch it from somewhere, store it on the session and return it. It’s kind of a lazy loading approach.

I believe this is a common pattern, but what is the name for the 'series of services'? I have considered names such as Delegate, Proxy, Facade, Loader, but none of those seem quite correct.

Aucun commentaire:

Enregistrer un commentaire