Comments (4)
Hi @hype8912 ,
Let me discuss on this with the team here and I will get back to you.
Kal Ali
NCache Team
from ncache.
Hi @hype8912
CacheItemVerson is an internal class therefore its constructor is also internal, its properties are used in class as read-only. Server is responsible for assigning values to Version property of CacheItemVersion class based upon incremental number whenever there is an update call to the Cache. User or client can only use CacheItemVersion class as an observer (read only).
The reason for keeping it this way is because the logic within the code is in such a way that it reads values that it has created itself in an incremental fashion. If a user updates it to something that may not be compatible with when NCache Server tries to read and work the value.
Please give us details as to why you require this so that I can help you better regarding this.
Kal Ali
NCache Team
from ncache.
In the code linked it shows the class as public "public class CacheItemVersion : IComparable". The only thing internal in that class is the constructors.
In development, we try to keep our implementation of a specific product isolated to a section of code so that we abstract our actual implementation encase we need to change it in the future. So for a cache implementation, I may have my own class that does the implementation of NCache that implements and exposes an ICache interface. The rest of my application will then have a dependency on ICache and not a direct implementation on NCache. I may then have an object called CacheEntry that implements properties like key, value, version, callbacks, expirations. This is so I'm not dependent on a specific cache implementation. The version in NCache is just a number. ULong to be exact. The ability to store a built-in type of ULong and not a CacheItemVersion allows a developer to not be fully dependent on the NCache. Right now we get around this by storing the CacheItemVersion as an object and then casting it back to a CacheItemVersion in the implementation but that really isn't needed if we could create a new CacheItemVersion class by passing in a ULong value.
The point I'm getting at is the only thing marked internal is the constructor which prevents creating an instance of the class. It doesn't prevent changing the Version value.
from ncache.
We've had a discussion with our engineering team about this, The reason we have kept the constructor of CacheItemVersion class private is because a unique version is assigned by the server to items in the cache and it is intentional so that version is always set by NCache on server side and not on the client side.
If the constructor is made public then there could be number of issues and one example could be that two threads might assign same cache item version to two separate cache items if it is done on the client side. Engineering plans to keep this private to ensure consistent version management behavior.
from ncache.
Related Issues (20)
- Cache events are not reliable HOT 2
- Unable to Build NCache Source HOT 2
- Memory consumption on pub/sub cache HOT 8
- Error on Get<T>: Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0" HOT 2
- NCache OSS 5.0 SP3- Unable to start cache after installation and configuration. Throw 'Specified cacheId is not registered' exception HOT 3
- NCache cann´t be installed on AWS virtual Machine. Please use "NCache OpenSource" AWS Image. HOT 3
- Unable to GetByTag or SearchService.GetByTag HOT 1
- AddNCacheSession does not work on .net 5.0 HOT 1
- Alachisoft.NCache.Runtime.Exceptions.OperationFailedException: 'Object reference not set to an instance of an object.' HOT 2
- Unable to compile latest source code HOT 1
- Disable all server logs not working HOT 2
- Creating NCacheDistributedCache without using AddNCacheDistributedCache HOT 1
- Exception when getting element from .NETCore that are added by .NET. HOT 1
- .Net 6.0 NCacheDistributedCache.CheckAndInitializeCache Fails HOT 1
- Fix the documentation links HOT 2
- Stop forcing response headers HOT 2
- BinaryFormatter has security flaws and requiring the paid version for JSON serialization is sketchy HOT 2
- OSS: TypeLoadException: Could not load typeProtoBuf.Serializers.Pooling.BufferPoolBase HOT 1
- Async Get<T> (and others) Operation
- .net core 2.0 System.Runtime higher
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ncache.