Implementing observer pattern using WCF

后端 未结 6 1069
眼角桃花
眼角桃花 2021-02-04 22:20

When I first posted this question I had strong coupling between my web service and application controller where the controller needed to open multiple threads to the service and

6条回答
  •  眼角桃花
    2021-02-04 22:34

    Not sure if this solution fits your particular task, but anyway:

    1. Add paging parameters to your WS API (int pageNumber, int pageSize, out int totalPages)
    2. Add a short-living TTL cache that associates request details (maybe a hash value) with output data

    When your application asks for the first page, return it as soon as it's ready and put the whole bunch of collected/merged data to cache so when the next page is required you may use what is already prepared.

    But note that you won't get the most up-to-date data, configure cache reloading interval cautiously.

提交回复
热议问题