アプリのデータベースと同じインスタンスに存在するデータベースで毎晩更新されるデータがあります。したがって、データベース呼び出しを節約するために、この 1 日の静的データを List(Of MyObject) にキャッシュしたいと考えています。理論的な観点から、このキャッシュされた List(Of ) は、グローバル変数を介してプレゼンテーション層コードにキャッシュされるべきですか? .DLL のグローバル変数に入れる必要がありますか?
GUIに公開され、.DLL内のデータアクセスレイヤーを呼び出すサービスレイヤーを作成したため、.DLLで考えています。
Public Shared Function Search(ByVal criteria As Core.Other.Customer) As List(Of Core.Other.Customer)
' TODO: Check the customer cache to see if it has been populated yet. If not, populate it.
If 1 = 1 Then
' TODO: Variable "list" needs to be a global object in the DLL.
' For SO readers: Dal class declared Friend.
Dim list As List(Of Core.Other.Customer) = Dal.Search.Customers.GetCache()
End If
Dim results As New List(Of Core.Other.Customer)
' TODO: Find the relevant customers in the cache and add them to variable "results".
Return results
End Function
私はこれを最善の方法で行っていますか?