S
Simon
Hi all,
We have an ASP.NET 1.1 application running on IIS6 on Server 2003.
Most of the base objects we are using in this application are taken from a
windows application also written by us. We have used shared properties on
some of these objects to enable caching of frequently used objects, so save
fetching them from SQL every time. These shared properties vastly increase
performance of our windows app.
So in our web app, we have left the same caching technique, by using shared
properties we cache various objects, usually in collections.
These collections have been strongly typed by utilising seperate classes and
storing an internal collection, e.g. see below.
Public Class AttributeCollection
Implements IEnumerable
Protected intCollection As New Collection
Public Overridable Sub Add(ByVal Attr As Attribute)
intCollection.Add(Attr, Attr.Name)
End Sub
Public Sub Remove(ByVal Attr As Attribute)
intCollection.Remove(Attr.Name)
End Sub
Public Sub Remove(ByVal AttrName As String)
intCollection.Remove(AttrName)
End Sub
Public Function Count() As Integer
Return intCollection.Count
End Function
Default ReadOnly Property Item(ByVal AttrName As String) As Attribute
Get
Return CType(intCollection.Item(AttrName), Attribute)
End Get
End Property
Default ReadOnly Property Item(ByVal index As Integer) As Attribute
Get
Return CType(intCollection.Item(index), Attribute)
End Get
End Property
Public Function GetEnumerator() As System.Collections.IEnumerator
Implements System.Collections.IEnumerable.GetEnumerator
Return intCollection.GetEnumerator
End Function
End Class
The problem, is that at certain times, the cached collection returns
containing nothing in the internal collection.
So the shared Property is returning ok, and is pointing to one of the
collections as shown above, however, the intcollection in the above code
contains nothing. so the code falls over. We cannot explain why the internal
collection for these objects is being emptied?
Anyone any ideas?
Thanks in advance and regards,
Simon.
We have an ASP.NET 1.1 application running on IIS6 on Server 2003.
Most of the base objects we are using in this application are taken from a
windows application also written by us. We have used shared properties on
some of these objects to enable caching of frequently used objects, so save
fetching them from SQL every time. These shared properties vastly increase
performance of our windows app.
So in our web app, we have left the same caching technique, by using shared
properties we cache various objects, usually in collections.
These collections have been strongly typed by utilising seperate classes and
storing an internal collection, e.g. see below.
Public Class AttributeCollection
Implements IEnumerable
Protected intCollection As New Collection
Public Overridable Sub Add(ByVal Attr As Attribute)
intCollection.Add(Attr, Attr.Name)
End Sub
Public Sub Remove(ByVal Attr As Attribute)
intCollection.Remove(Attr.Name)
End Sub
Public Sub Remove(ByVal AttrName As String)
intCollection.Remove(AttrName)
End Sub
Public Function Count() As Integer
Return intCollection.Count
End Function
Default ReadOnly Property Item(ByVal AttrName As String) As Attribute
Get
Return CType(intCollection.Item(AttrName), Attribute)
End Get
End Property
Default ReadOnly Property Item(ByVal index As Integer) As Attribute
Get
Return CType(intCollection.Item(index), Attribute)
End Get
End Property
Public Function GetEnumerator() As System.Collections.IEnumerator
Implements System.Collections.IEnumerable.GetEnumerator
Return intCollection.GetEnumerator
End Function
End Class
The problem, is that at certain times, the cached collection returns
containing nothing in the internal collection.
So the shared Property is returning ok, and is pointing to one of the
collections as shown above, however, the intcollection in the above code
contains nothing. so the code falls over. We cannot explain why the internal
collection for these objects is being emptied?
Anyone any ideas?
Thanks in advance and regards,
Simon.