GUID到底是什么?为什么在何处使用它? [英] What exactly is GUID? Why and where I should use it?

查看:762
本文介绍了GUID到底是什么?为什么在何处使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GUID到底是什么?为什么在何处使用它?
我在很多地方都看到过GUID的参考资料,在Wikipedia中, 但是告诉您在哪里使用它还不是很清楚. 如果有人可以回答这个问题,那就太好了. 谢谢

What exactly is GUID? Why and where I should use it?
I've seen references to GUID in a lot of places, and in wikipedia, but it is not very clear telling you where to use it. If someone could answer this, it would be nice. Thanks

推荐答案

GUID在技术上代表全局唯一标识符.实际上,它是一个128位结构,不太可能重复或产生碰撞.如果您进行数学运算,则值的域在十一进制中.

GUID technically stands for globally unique identifier. What it is, actually, is a 128 bit structure that is unlikely to ever repeat or create a collision. If you do the maths, the domain of values is in the undecillions.

当您有多个独立的系统或客户端生成需要唯一的ID时,请使用向导.

Use guids when you have multiple independent systems or clients generating ID's that need to be unique.

例如,如果我有5个客户端应用程序在ID上具有唯一约束的表中创建事务数据并将事务数据插入到表中,则请使用guids.这样可以避免强制客户端首先从服务器请求发出的ID.

For example, if I have 5 client apps creating and inserting transactional data into a table that has a unique constraint on the ID, then use guids. This prevents having to force a client to request an issued ID from the server first.

这对于对象工厂和系统也非常有用,因为对象工厂和系统具有存储在不同表中的大量对象类型,在这些表中您不希望任何两个对象具有相同的ID.这使得缓存和清除模式更易于实现.

This is also great for object factories and systems that have numerous object types stored in different tables where you don't want any 2 objects to have the same ID. This makes caching and scavenging schemas much easier to implement.

这篇关于GUID到底是什么?为什么在何处使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆