摘要
介绍软件运行时本地业务数据存储在应用软件中的重要性,尤其是互联网客户端软件,例如IM即时通信软件。分析传统存储模式的优缺点,并在此基础上提出一种叫做共享数据层的设计模式。它采用写时拷贝技术、带有引用计数的智能指针技术,解决数据的多线程读写安全、数据的生命周期管理等问题;通过数据的订阅模式,实现应用层和数据层的隔离,提高业务逻辑与数据源的松耦合。
Mainly introduces the importance in application of local business data storage, especially client software of Internet, such as IM (Instant Messaging) software. Analyses the advantages and disadvantages of the traditional storage mode, and proposes a design model called shared data based on the traditional mode. It adpots copy on write technique and smart pointer technique with reference count, it solves the security of data's muhi-threaded read and write, and it solves the problem of data litifecyele management,etc. It realizes the separation of application layer and data layer, and improves the business logic and the loose coupling of data sources by means of data subscription model.