I have a bit of a dilemma regarding how to cache the server object so I don't have to reconnect all the time.
I have a web service which serves AS2005 data, and whenever the cube schema changes (or sometimes just after a process), the server object doesn't return the cubes collection, and I end up having to restart IIS or the app to clear the application obj and start again. Obviously this is not the best. Is there anyway I can detect for schema changes in the server object, and serve up a fresh obj if there has been?
I'm using the following code:
Code Snippet
Dim server As OlapServer.Server = Me.Application.Get(cubeServerStorageKey)
If (server Is Nothing) Then
Dim cubeServer As String = System.Configuration.ConfigurationManager.AppSettings.Get("Analysis Server")
If (String.IsNullOrEmpty(cubeServer)) Then _
cubeServer = "."
Dim cubeServerTimeoutSeconds As String = System.Configuration.ConfigurationManager.AppSettings.Get("Cube Timeout")
server = New OlapServer.Server(cubeServer, Me.RequestData.Database, Int32.Parse(cubeServerTimeoutSeconds))
server.Connect()
Me.Application.Set(cubeServerStorageKey, server)
End If
Return server
hello,
could you please clarify a bit. I believe adomd.net does not have an OlapServer class in it (nor does AMO). So, can you please provide relevant code (i guess of how the OlapServer object returns you the cubes collection, since from the problem description you mention that this is where the problem occurs), because without that code it is hard to tell what the problem might be or how to solve it.
thanks a lot,
|||Well why would you want to cache such a connection? 100ms routine is hardly worthy of cache. Chaching the return dataset I can see, but connection? Sorry if I misunderstood.
Also, you can use .NET's cache methods to specify an exact timeout for a cached object.
No comments:
Post a Comment