What does "urn:" stand for?
I am playing with the ServiceStack Redis example. It seems like a naming convention, many keys in the db starting with "urn:".
By calling somePoco.CreateUrn();
--> "urn:somePoco:123"
It creates the key in the database.
And the advantage of it is that RedisTypedClient can regonize it in the following code: e.g.
var redisSomePoco = redis.As<SomePoco>();
var somePoco = redisSomePoco.GetById("123"); //it knows I want value of key "urn:somePoco:123"
redisSomePoco.Store(somePoco); //it knows how to store my poco value in key "urn:somePoco:123"
//"{\"Id\":123,\"DisplayName\":\"Michael\"}"
Is my understanding correct? Or am I even close?
It stands for Uniform Resource Name.
Since there is no concept of namespaces or schemas in Redis we use a fully-qualified key with the format of:
urn:{TypeName}:{Id}
To uniquely store and identify any POCO instance stored in Redis using the Typed API of ServiceStack's C# RedisClient.
The RedisAdmin UI also takes advantage of this convention to provide a hierarchical tree-like structure to access your data despite their being no concept of such in Redis.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With