CN104166820B - A kind of data managing method and system - Google Patents
A kind of data managing method and system Download PDFInfo
- Publication number
- CN104166820B CN104166820B CN201310182433.9A CN201310182433A CN104166820B CN 104166820 B CN104166820 B CN 104166820B CN 201310182433 A CN201310182433 A CN 201310182433A CN 104166820 B CN104166820 B CN 104166820B
- Authority
- CN
- China
- Prior art keywords
- user data
- offline user
- offline
- management
- management application
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0629—Configuration or reconfiguration of storage systems
- G06F3/0631—Configuration or reconfiguration of storage systems by allocating resources to storage systems
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0646—Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
- G06F3/0652—Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明实施例公开了一种数据管理方法和系统,以解决无法对客户端平台的离线用户数据进行管理的问题。所述方法包括提前加载满足存储条件的离线用户数据至固定容量的内存池中;在服务器应用运行过程中接收在线用户对离线用户数据的管理申请;验证在线用户和管理申请是否均具有管理权限;当在线用户和管理申请均具有管理权限时,查询内存池中是否存在与管理申请对应的离线用户数据;当存在时,发送与管理申请对应的离线用户数据至在线用户终端,并保留与管理申请对应的离线用户数据在内存池中。提前加载高频访问的离线用户数据,对低频访问的离线用户数据在存储后进行释放,高频访问的离线用户数据保留在内存池中,减少了数据库端的存储压力。
The embodiment of the invention discloses a data management method and system to solve the problem that offline user data of a client platform cannot be managed. The method includes loading offline user data satisfying storage conditions in advance into a fixed-capacity memory pool; receiving an online user's management application for offline user data during the running of the server application; verifying whether the online user and the management application both have management authority; When both the online user and the management application have management authority, query whether there is offline user data corresponding to the management application in the memory pool; if there is, send the offline user data corresponding to the management application to the online user terminal, and save it with the management application The corresponding offline user data is in the memory pool. High-frequency offline user data is loaded in advance, low-frequency offline user data is stored and released, and high-frequency offline user data is kept in the memory pool, reducing the storage pressure on the database side.
Description
技术领域technical field
本发明实施例涉及计算机技术领域,特别是涉及一种数据管理方法和系统。The embodiments of the present invention relate to the field of computer technology, and in particular to a data management method and system.
背景技术Background technique
存储在数据库中的数据,可以包括在线用户数据和离线用户数据。在线用户为与服务器处于连接状态的用户,离线用户为与服务器处于断开状态的用户。The data stored in the database may include online user data and offline user data. An online user is a user who is connected to the server, and an offline user is a user who is disconnected from the server.
当用户在线时,在线用户的数据会被服务器从数据库中暂时调取出来,并暂存在运行中的服务器中。由服务器对在线用户数据进行实时修改,并在特定时间回写到数据库中。When the user is online, the data of the online user will be temporarily retrieved from the database by the server and temporarily stored in the running server. The online user data is modified in real time by the server and written back to the database at a specific time.
当用户离线时,离线用户的数据会从运行中的服务器中被移除。此时运行中的服务器将无法获取离线用户的任何信息。When a user goes offline, the offline user's data is removed from the running server. At this time, the running server will not be able to obtain any information of offline users.
在线用户管理存储在数据库中的离线用户数据的方法为:在线用户直连数据库,在数据库中对离线用户数据进行读取、修改、删除等操作后保存离线用户数据在数据库中。The method for the online user to manage the offline user data stored in the database is as follows: the online user directly connects to the database, performs operations such as reading, modifying, and deleting the offline user data in the database, and then saves the offline user data in the database.
以游戏为例,目前主要有客户端平台游戏和网页平台游戏两种,在网页平台游戏中,在线用户可以通过上述方法管理离线用户数据,但是由于客户端平台游戏的用户数据交互性更强,用户的数据量更大,存储在数据库中的离线用户数据也更大,从数据库中访问离线用户数据需要很高性能的服务器和数据库,传输大容量的离线用户数据还需要更高的网络带宽;而且客户端平台的离线用户数据的数据信息、属性更加丰富,不同的离线用户数据之间还可能存在各种关联关系,所以对客户端平台游戏的离线用户的数据管理复杂性更高,目前还不存在针对客户端平台游戏的离线用户数据管理方法。Taking games as an example, there are currently two types of client platform games and web platform games. In web platform games, online users can manage offline user data through the above methods. However, since the user data of client platform games is more interactive, The amount of user data is larger, and the offline user data stored in the database is also larger. Accessing offline user data from the database requires a high-performance server and database, and transmitting large-capacity offline user data also requires higher network bandwidth; Moreover, the data information and attributes of offline user data on the client platform are richer, and there may be various correlations between different offline user data, so the data management of offline user data on the client platform is more complicated. There is no offline user data management method for client platform games.
发明内容Contents of the invention
本发明实施例公开一种数据管理方法和系统,以解决无法对客户端平台的离线用户数据进行管理的问题。The embodiment of the present invention discloses a data management method and system to solve the problem that offline user data of a client platform cannot be managed.
为了解决上述问题,本发明实施例公开了一种数据管理方法,包括:In order to solve the above problems, the embodiment of the present invention discloses a data management method, including:
在服务器应用启动时,提前加载满足存储条件的离线用户数据至已创建的固定容量的内存池中;When the server application starts, offline user data that meets the storage conditions is loaded in advance to the created fixed-capacity memory pool;
在服务器应用运行过程中,接收在线用户对离线用户数据的管理申请,所述管理申请与离线用户数据具有映射关系;During the running process of the server application, a management application for offline user data is received from an online user, and the management application has a mapping relationship with the offline user data;
验证所述在线用户和所述管理申请是否均具有对离线用户数据进行管理的权限;Verifying whether the online user and the management application both have the authority to manage offline user data;
当所述在线用户和所述管理申请均具有对离线用户数据进行管理的权限时,查询所述内存池中是否存在与所述管理申请对应的离线用户数据;When both the online user and the management application have the authority to manage offline user data, query whether there is offline user data corresponding to the management application in the memory pool;
当所述内存池中存在与所述管理申请对应的离线用户数据时,发送与所述管理申请对应的离线用户数据至在线用户终端,并保留与所述管理申请对应的离线用户数据在所述内存池中。When there is offline user data corresponding to the management application in the memory pool, send the offline user data corresponding to the management application to the online user terminal, and keep the offline user data corresponding to the management application in the in the memory pool.
优选的,所述查询所述内存池中是否存在与所述管理申请对应的离线用户数据之后,所述方法还包括:Preferably, after querying whether there is offline user data corresponding to the management application in the memory pool, the method further includes:
当所述内存池中不存在与所述管理申请对应的离线用户数据时,从数据库中读取出与所述管理申请对应的离线用户数据,并存储到所述内存池中。When the offline user data corresponding to the management application does not exist in the memory pool, the offline user data corresponding to the management application is read from the database and stored in the memory pool.
优选的,所述验证所述在线用户和所述管理申请是否均具有对离线用户数据进行管理的权限,包括:Preferably, the verifying whether the online user and the management application both have the authority to manage offline user data includes:
判断所述在线用户是否属于具有管理与所述管理申请对应的离线用户数据的权限的用户;judging whether the online user belongs to a user with authority to manage offline user data corresponding to the management application;
当所述在线用户属于具有管理与所述管理申请对应的离线用户数据的权限的用户时,判断所述管理申请是否符合与所述管理申请对应的离线用户数据的管理条件,所述管理条件包括离线用户数据中的各项数据是否允许被读取、修改和删除;When the online user belongs to a user with authority to manage the offline user data corresponding to the management application, determine whether the management application meets the management conditions of the offline user data corresponding to the management application, and the management conditions include Whether the data in the offline user data is allowed to be read, modified and deleted;
当所述在线用户属于具有管理与所述管理申请对应的离线用户数据的权限的用户,且所述管理申请符合与所述管理申请对应的离线用户数据的管理条件时,确定所述在线用户和所述管理申请均具有对离线用户数据进行管理的权限;When the online user belongs to a user with authority to manage the offline user data corresponding to the management application, and the management application meets the management conditions of the offline user data corresponding to the management application, determine the online user and The management applications all have the authority to manage offline user data;
当所述在线用户不属于具有管理与所述管理申请对应的离线用户数据的权限的用户时,确定所述在线用户不具有对离线用户数据进行管理的权限;当所述管理申请不符合与所述管理申请对应的离线用户数据的管理条件时,确定所述管理申请均不具有对离线用户数据进行管理的权限。When the online user does not belong to the user with the authority to manage the offline user data corresponding to the management application, it is determined that the online user does not have the authority to manage the offline user data; When determining the management conditions of the offline user data corresponding to the management application, it is determined that none of the management applications has the authority to manage the offline user data.
优选的:所述存储条件为离线用户数据的访问频率大于等于预定阈值。Preferably: the storage condition is that the access frequency of offline user data is greater than or equal to a predetermined threshold.
优选的,所述方法还包括:Preferably, the method also includes:
依次查询所述内存池中的离线用户数据;Querying the offline user data in the memory pool in turn;
如果所述内存池中的离线用户数据在第一预置时间段内未被访问,将在所述第一预置时间段内未被访问的离线用户数据存储至数据库中,并在所述内存池中删除;If the offline user data in the memory pool has not been accessed within the first preset time period, the offline user data that has not been accessed within the first preset time period will be stored in the database, and stored in the memory pool pool delete;
如果所述内存池中的离线用户数据在第二预置时间段内被访问过,保留在所述第二预置时间段内被访问过的离线用户数据至所述内存池中。If the offline user data in the memory pool has been accessed within a second preset time period, retain the offline user data accessed within the second preset time period in the memory pool.
本发明实施例还公开了一种数据管理系统,包括:The embodiment of the present invention also discloses a data management system, including:
加载模块,用于在服务器应用启动时,提前加载满足存储条件的离线用户数据至已创建的固定容量的内存池中;The loading module is used to pre-load offline user data that meets the storage conditions into the created fixed-capacity memory pool when the server application starts;
接收模块,用于在服务器应用运行过程中,接收在线用户对离线用户数据的管理申请,所述管理申请与离线用户数据具有映射关系;The receiving module is configured to receive a management application for offline user data from an online user during the running process of the server application, and the management application has a mapping relationship with the offline user data;
验证模块,用于验证所述在线用户和所述管理申请是否均具有对离线用户数据进行管理的权限;A verification module, configured to verify whether both the online user and the management application have the authority to manage offline user data;
查询模块,用于当所述在线用户和所述管理申请均具有对离线用户数据进行管理的权限时,查询所述内存池中是否存在与所述管理申请对应的离线用户数据;A query module, configured to query whether there is offline user data corresponding to the management application in the memory pool when both the online user and the management application have the authority to manage offline user data;
发送保留模块,用于当所述内存池中存在与所述管理申请对应的离线用户数据时,发送与所述管理申请对应的离线用户数据至在线用户终端,并保留与所述管理申请对应的离线用户数据在所述内存池中。A sending and retaining module, configured to send the offline user data corresponding to the management application to an online user terminal when there is offline user data corresponding to the management application in the memory pool, and retain the data corresponding to the management application Offline user data is in the memory pool.
优选的,所述系统还包括:Preferably, the system also includes:
读取存储模块,用于在所述查询模块查询所述内存池中是否存在与所述管理申请对应的离线用户数据之后,当所述内存池中不存在与所述管理申请对应的离线用户数据时,从数据库中读取出与所述管理申请对应的离线用户数据,并存储到所述内存池中。The reading storage module is used to, after the query module inquires whether there is offline user data corresponding to the management application in the memory pool, when there is no offline user data corresponding to the management application in the memory pool , the offline user data corresponding to the management application is read from the database and stored in the memory pool.
优选的,所述验证模块,包括:Preferably, the verification module includes:
在线用户判断子模块,用于判断所述在线用户是否属于具有管理与所述管理申请对应的离线用户数据的权限的用户;An online user judging submodule, configured to judge whether the online user belongs to a user with authority to manage offline user data corresponding to the management application;
管理申请判断子模块,用于当所述在线用户属于具有管理与所述管理申请对应的离线用户数据的权限的用户时,判断所述管理申请是否符合与所述管理申请对应的离线用户数据的管理条件,所述管理条件包括离线用户数据中的各项数据是否允许被读取、修改和删除;The management application judging sub-module is used to judge whether the management application conforms to the requirements of the offline user data corresponding to the management application when the online user belongs to a user with authority to manage the offline user data corresponding to the management application Management conditions, the management conditions include whether each data in the offline user data is allowed to be read, modified and deleted;
确定子模块,用于当所述在线用户属于具有管理与所述管理申请对应的离线用户数据的权限的用户,且所述管理申请符合与所述管理申请对应的离线用户数据的管理条件时,确定所述在线用户和所述管理申请均具有对离线用户数据进行管理的权限;当所述在线用户不属于具有管理与所述管理申请对应的离线用户数据的权限的用户时,确定所述在线用户不具有对离线用户数据进行管理的权限;当所述管理申请不符合与所述管理申请对应的离线用户数据的管理条件时,确定所述管理申请均不具有对离线用户数据进行管理的权限。A determining submodule, configured to: when the online user belongs to a user with authority to manage the offline user data corresponding to the management application, and the management application meets the management conditions of the offline user data corresponding to the management application, determining that both the online user and the management application have the authority to manage offline user data; when the online user does not belong to a user with authority to manage offline user data corresponding to the management application, determine that the The user does not have the right to manage offline user data; when the management application does not meet the management conditions for offline user data corresponding to the management application, it is determined that none of the management applications has the right to manage offline user data .
优选的:所述存储条件为离线用户数据的访问频率大于等于预定阈值。Preferably: the storage condition is that the access frequency of offline user data is greater than or equal to a predetermined threshold.
优选的,所述系统还包括:Preferably, the system also includes:
查询管理模块,用于依次查询所述内存池中的离线用户数据;如果所述内存池中的离线用户数据在第一预置时间段内未被访问,将在所述第一预置时间段内未被访问的离线用户数据存储至数据库中,并在所述内存池中删除;如果所述内存池中的离线用户数据在第二预置时间段内被访问过,保留在所述第二预置时间段内被访问过的离线用户数据至所述内存池中。A query management module, configured to sequentially query the offline user data in the memory pool; if the offline user data in the memory pool is not accessed within a first preset time period, it will Store the offline user data that has not been accessed within the database and delete it in the memory pool; if the offline user data in the memory pool has been accessed within the second preset time period, it will be kept in the second Offline user data accessed within a preset time period is stored in the memory pool.
与背景技术相比,本发明实施例包括以下优点:Compared with the background technology, the embodiments of the present invention include the following advantages:
本发明实施例公开的一种数据管理方法和系统,在客户端平台的服务器中创建固定容量的内存池,在服务器应用每次启动时,提前加载高频访问的离线用户数据至内存池中。在服务器应用运行过程中,当接收到在线用户对离线用户数据的管理申请时,在内存池中查询是否存在欲管理的离线用户数据,如果存在,将欲管理的离线用户数据(高频访问的离线用户数据)发送至在线用户终端,并保留欲管理的离线用户数据(高频访问的离线用户数据)在内存池中;如果不存在,从数据库中读取出欲管理的离线用户数据(低频访问的离线用户数据),加载到内存池中,再从内存池中发送欲管理的离线用户数据(低频访问的离线用户数据)至在线用户终端,将管理后的离线用户数据(低频访问的离线用户数据)存储到数据库中,并在内存池中删除该离线用户数据。提前将高频访问的离线用户数据加载和缓存在内存池中,对内存池中低频访问的离线用户数据在存储至数据库后从内存池中释放,高频访问的离线用户数据保留在内存池中,只将低频访问的离线用户数据保存到数据库中,减少了数据库端的存储压力。In the data management method and system disclosed in the embodiments of the present invention, a fixed-capacity memory pool is created in the server of the client platform, and frequently accessed offline user data is loaded into the memory pool in advance each time the server application is started. During the running of the server application, when an online user's application for offline user data management is received, it will query whether there is offline user data to be managed in the memory pool. If it exists, the offline user data to be managed (high-frequency access offline user data) to the online user terminal, and keep the offline user data to be managed (offline user data with high frequency access) in the memory pool; if it does not exist, read the offline user data to be managed from the database (low frequency access Offline user data accessed by users), loaded into the memory pool, and then the offline user data to be managed (offline user data with infrequent access) is sent from the memory pool to the online user terminal, and the managed offline user data (offline user data with infrequent access) User data) is stored in the database, and the offline user data is deleted in the memory pool. Load and cache frequently accessed offline user data in the memory pool in advance, store infrequently accessed offline user data in the memory pool and release it from the memory pool, and frequently access offline user data remain in the memory pool , only save offline user data accessed infrequently to the database, reducing the storage pressure on the database side.
而且,使用固定容量的内存池加载和缓存离线用户数据,内存池的容量固定,对其中的离线用户数据进行清除和将离线用户数据加载和缓存到内存池中,产生的内存碎片较少。如果利用动态容量的内存池加载和缓存离线用户数据,加载和缓存的离线用户数据越多,内存池的容量会越大,相对较大容量的内存池就会产生较多的内存碎片。Moreover, a memory pool with a fixed capacity is used to load and cache offline user data. The capacity of the memory pool is fixed. Clearing the offline user data therein and loading and caching the offline user data into the memory pool results in less memory fragmentation. If you use a memory pool with dynamic capacity to load and cache offline user data, the more offline user data you load and cache, the larger the capacity of the memory pool will be, and a memory pool with a relatively large capacity will generate more memory fragments.
使用固定容量的内存池加载和缓存离线用户数据,服务器端剩余内存的容量也固定,不会因为加载和缓存离线用户数据的内存池越来越大,造成服务器端剩余内存减小的情况,保证了服务器端用于应用运行的内存容量。Use a fixed-capacity memory pool to load and cache offline user data, and the capacity of the remaining memory on the server side is also fixed, so that the remaining memory on the server side will not decrease because the memory pool for loading and caching offline user data is getting larger and larger. The memory capacity used by the server side for application running.
因为产生的内存碎片较少,降低了服务器的运行风险(内存碎片越多,服务器异常宕机风险越高)。Because less memory fragments are generated, the running risk of the server is reduced (the more memory fragments, the higher the risk of abnormal server downtime).
同时,动态调节内存池中的离线用户数据,当高频访问离线用户数据变为低频访问离线用户数据时,可以及时对这些离线用户数据进行清理,提高了内存池的使用率。At the same time, the offline user data in the memory pool is dynamically adjusted. When high-frequency access to offline user data becomes low-frequency access to offline user data, these offline user data can be cleaned up in time, which improves the utilization rate of the memory pool.
进一步地,由于内存池中缓存离线用户数据,当服务器与数据库的连接断开时,离线用户数据可以安全存放在内存池中,当连接重新建立后,离线用户数据可以继续存入数据库中,降低了离线用户数据丢失的风险。Furthermore, since the offline user data is cached in the memory pool, when the connection between the server and the database is disconnected, the offline user data can be safely stored in the memory pool, and when the connection is re-established, the offline user data can continue to be stored in the database, reducing the The risk of offline user data loss is reduced.
附图说明Description of drawings
图1是本发明实施例中一种数据管理方法流程图;Fig. 1 is a flow chart of a data management method in an embodiment of the present invention;
图2是本发明实施例中一种数据管理方法示意图;Fig. 2 is a schematic diagram of a data management method in an embodiment of the present invention;
图3是本发明实施例中一种离线玩家数据清理示意图;Fig. 3 is a schematic diagram of offline player data cleaning in an embodiment of the present invention;
图4是本发明实施例中客户端游戏和网页游戏结合的整体结构图;FIG. 4 is an overall structural diagram of the combination of the client game and the web game in the embodiment of the present invention;
图5是本发明实施例中一种数据管理系统结构图;5 is a structural diagram of a data management system in an embodiment of the present invention;
图6是本发明实施例中客户端游戏中管理离线用户数据的结构示意图。Fig. 6 is a schematic structural diagram of managing offline user data in a client game according to an embodiment of the present invention.
具体实施方式detailed description
为使本发明的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本发明作进一步详细的说明。In order to make the above objects, features and advantages of the present invention more comprehensible, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
实施例一Embodiment one
详细介绍本发明实施例公开的一种数据管理方法。A data management method disclosed in the embodiment of the present invention is introduced in detail.
参照图1,示出了本发明实施例中一种数据管理方法流程图。Referring to FIG. 1 , it shows a flowchart of a data management method in an embodiment of the present invention.
步骤100,在服务器应用启动时,提前加载满足存储条件的离线用户数据至已创建的固定容量的内存池中。Step 100, when the server application is started, offline user data meeting storage conditions is loaded in advance into the created memory pool with fixed capacity.
所述服务器可以指用于运行应用的服务器。The server may refer to a server for running applications.
所述存储条件可以为离线用户数据的访问频率大于等于预定阈值。The storage condition may be that the access frequency of offline user data is greater than or equal to a predetermined threshold.
例如:某离线用户数据在一个月(按30天计算)的时间内,被访问的次数为60次,则该离线用户数据的访问频率为2次/天。如果预定阈值为1次/天,那么该离线用户数据满足存储条件。For example: if an offline user data is accessed 60 times within a month (calculated as 30 days), then the offline user data access frequency is 2 times/day. If the predetermined threshold is 1 time/day, then the offline user data meets the storage condition.
所述固定容量的内存池可以为服务器内存的一部分,所述内存池用于存储离线用户数据,所述内存池可以不用于参与服务器的应用运行。The fixed-capacity memory pool may be a part of the server memory, the memory pool is used to store offline user data, and the memory pool may not be used to participate in the running of the server application.
步骤102,在服务器应用运行过程中,接收在线用户对离线用户数据的管理申请。Step 102: During the running process of the server application, an online user's application for managing offline user data is received.
所述管理申请与离线用户数据具有映射关系。The management application has a mapping relationship with offline user data.
例如,某在线用户提出离线用户数据的管理申请,所述管理申请可以对某离线用户数据进行访问、修改或者删除等。For example, an online user submits a management application for offline user data, and the management application may access, modify, or delete certain offline user data.
步骤104,验证所述在线用户和所述管理申请是否均具有对离线用户数据进行管理的权限。Step 104, verify whether the online user and the management application both have the authority to manage offline user data.
所述步骤104可以包括两步验证操作,一步是验证在线用户是否具有对某离线用户数据的管理权限,该离线用户数据即管理申请对应的离线用户数据;另一步是验证管理申请是否满足其对应的离线用户数据的管理条件。The step 104 may include two-step verification operations, one step is to verify whether the online user has management authority to a certain offline user data, and the offline user data is the offline user data corresponding to the management application; the other step is to verify whether the management application meets its corresponding The management conditions of offline user data.
优选的,所述步骤104可以包括:Preferably, said step 104 may include:
子步骤1041,判断所述在线用户是否属于具有管理与所述管理申请对应的离线用户数据的权限的用户。Sub-step 1041, judging whether the online user belongs to a user who has the authority to manage offline user data corresponding to the management application.
例如,具有管理离线用户数据D1的权限的在线用户包括A、B和C,如果在线用户A提出对离线用户数据D1的管理申请,则在线用户A属于具有管理离线用户数据D1的权限的在线用户;如果在线用户D提出对离线用户数据D1的管理申请,则在线用户D不属于具有管理离线用户数据D1的权限的在线用户。For example, online users who have the right to manage offline user data D1 include A, B, and C. If online user A applies for management of offline user data D1, online user A belongs to the online user who has the right to manage offline user data D1 ; If the online user D puts forward a management application for the offline user data D1, the online user D does not belong to the online user with the authority to manage the offline user data D1.
子步骤1042,当所述在线用户属于具有管理与所述管理申请对应的离线用户数据的权限的用户时,判断所述管理申请是否符合与所述管理申请对应的离线用户数据的管理条件。Sub-step 1042, when the online user belongs to a user with authority to manage the offline user data corresponding to the management application, determine whether the management application meets the management conditions of the offline user data corresponding to the management application.
所述管理条件可以包括离线用户数据中的各项数据是否允许被读取、修改和删除。The management conditions may include whether each item of data in the offline user data is allowed to be read, modified and deleted.
例如,离线用户数据D1的管理条件是允许被读取、不允许被修改和删除。当在线用户A属于具有管理离线用户数据D1的权限的在线用户时,如果在线用户A提出的管理申请是修改离线用户数据D1,则在线用户A提出的管理申请不符合离线用户数据D1的管理条件;如果在线用户A提出的管理申请是读取离线用户数据D1,则在线用户A提出的管理申请符合离线用户数据D1的管理条件。For example, the management condition of offline user data D1 is that it is allowed to be read, not allowed to be modified and deleted. When online user A belongs to the online user with the authority to manage offline user data D1, if the management application submitted by online user A is to modify offline user data D1, the management application submitted by online user A does not meet the management conditions of offline user data D1 ; If the management application made by the online user A is to read the offline user data D1, then the management application made by the online user A meets the management conditions of the offline user data D1.
当所述在线用户属于具有管理与所述管理申请对应的离线用户数据的权限的用户,且所述管理申请符合与所述管理申请对应的离线用户数据的管理条件时,确定所述在线用户和所述管理申请均具有对离线用户数据进行管理的权限。When the online user belongs to a user with authority to manage the offline user data corresponding to the management application, and the management application meets the management conditions of the offline user data corresponding to the management application, determine the online user and The management applications all have the authority to manage offline user data.
当所述在线用户不属于具有管理与所述管理申请对应的离线用户数据的权限的用户时,确定所述在线用户不具有对离线用户数据进行管理的权限;当所述管理申请不符合与所述管理申请对应的离线用户数据的管理条件时,确定所述管理申请均不具有对离线用户数据进行管理的权限。When the online user does not belong to the user with the authority to manage the offline user data corresponding to the management application, it is determined that the online user does not have the authority to manage the offline user data; When determining the management conditions of the offline user data corresponding to the management application, it is determined that none of the management applications has the authority to manage the offline user data.
步骤106,当所述在线用户和所述管理申请均具有对离线用户数据进行管理的权限时,查询所述内存池中是否存在与所述管理申请对应的离线用户数据。Step 106, when both the online user and the management application have the authority to manage offline user data, query whether there is offline user data corresponding to the management application in the memory pool.
例如,当在线用户A和在线用户A提出的管理申请均具有对离线用户数据D1的管理权限时,查询离线用户数据D1是否存在于内存池中。并且在线用户A提出的管理申请是对离线用户数据D1进行管理。For example, when both the online user A and the management application submitted by the online user A have the management authority on the offline user data D1, query whether the offline user data D1 exists in the memory pool. And the management application submitted by the online user A is to manage the offline user data D1.
步骤108,当所述内存池中不存在与所述管理申请对应的离线用户数据时,从数据库中读取出与所述管理申请对应的离线用户数据,并存储到所述内存池中。Step 108, when there is no offline user data corresponding to the management application in the memory pool, read the offline user data corresponding to the management application from the database, and store it in the memory pool.
在所述步骤108之后,可以将存储到内存池中的离线用户数据发送至在线用户终端进行管理操作。并且可以在管理操作结束后,将管理后的离线用户数据保存到数据库中,并从内存池中删除。还可以在管理操作结束后,将管理后的离线用户数据保存到数据库中,并在内存池中保留。After the step 108, the offline user data stored in the memory pool may be sent to the online user terminal for management operations. And after the management operation is finished, the managed offline user data can be saved in the database and deleted from the memory pool. It is also possible to save the managed offline user data in the database after the management operation ends, and keep it in the memory pool.
步骤110,当所述内存池中存在与所述管理申请对应的离线用户数据时,发送与所述管理申请对应的离线用户数据至在线用户终端,并保留与所述管理申请对应的离线用户数据在所述内存池中。Step 110, when there is offline user data corresponding to the management application in the memory pool, sending the offline user data corresponding to the management application to an online user terminal, and retaining the offline user data corresponding to the management application in the memory pool.
所述步骤110中的重要执行操作可以理解为:The important execution operations in the step 110 can be understood as:
在对离线用户数据进行管理后,将管理后的离线用户数据保留在内存池中,可以方便之后的在线用户对该离线用户数据进行管理操作。After the offline user data is managed, the managed offline user data is kept in the memory pool, which can facilitate subsequent online users to manage the offline user data.
步骤112,对所述内存池中的离线用户数据进行清理操作。Step 112, perform a cleaning operation on the offline user data in the memory pool.
由于内存池的容量固定,不可能无限制地存储离线用户数据,所以需要定期或者持续对内存池中的离线用户数据进行清理。Since the capacity of the memory pool is fixed, it is impossible to store offline user data without limit, so it is necessary to periodically or continuously clean up the offline user data in the memory pool.
清理的目的是将高频访问的离线用户数据保留在内存池中,将低频访问的离线用户数据存储回数据库中,并在内存池中删除,以便可以留出足够的内存池空间加载并缓存其他的离线用户数据。The purpose of cleaning is to keep the frequently accessed offline user data in the memory pool, store the infrequently accessed offline user data back into the database, and delete them from the memory pool, so that enough memory pool space can be left for loading and caching other offline user data.
优选的,所述步骤112可以包括:Preferably, said step 112 may include:
依次查询所述内存池中的离线用户数据。如果所述内存池中的离线用户数据在第一预置时间段内未被访问,将在所述第一预置时间段内未被访问的离线用户数据存储至数据库中,并在所述内存池中删除;如果所述内存池中的离线用户数据在第二预置时间段内被访问过,保留在所述第二预置时间段内被访问过的离线用户数据至所述内存池中。The offline user data in the memory pool is queried sequentially. If the offline user data in the memory pool has not been accessed within the first preset time period, the offline user data that has not been accessed within the first preset time period will be stored in the database, and stored in the memory pool Deleting from the pool; if the offline user data in the memory pool has been accessed within the second preset time period, keep the offline user data accessed within the second preset time period in the memory pool .
例如,内存池中包括3个离线用户数据,分别为D1、D2和D3。如果D1在2天内未被访问,则将D1存储到数据库中,并将D1从内存池中删除;如果D2和D3在1天内被访问过,则保留D2和D3在内存池中。For example, the memory pool includes 3 offline user data, namely D1, D2 and D3. If D1 has not been accessed within 2 days, store D1 in the database and delete D1 from the memory pool; if D2 and D3 have been accessed within 1 day, keep D2 and D3 in the memory pool.
所述第一预置时间段和第二预置时间段可以根据实际情况设定。The first preset time period and the second preset time period can be set according to actual conditions.
需要说明的是,所述步骤112可以在所述步骤100之后的任何时刻执行,可以定期执行一次或多次,也可以持续执行。It should be noted that the step 112 may be performed at any time after the step 100, may be performed periodically one or more times, or may be continuously performed.
下面,主要以游戏为例,介绍游戏运行时的数据管理方法。In the following, the game is mainly taken as an example to introduce the data management method when the game is running.
参照图2,示出了本发明实施例中一种数据管理方法示意图。Referring to FIG. 2 , it shows a schematic diagram of a data management method in an embodiment of the present invention.
步骤200,接收玩家对离线玩家数据的管理申请。Step 200, receiving a player's application for managing offline player data.
步骤202,离线玩家数据管理器查询内存池中是否存在与管理申请对应的离线玩家数据。In step 202, the offline player data manager inquires whether there is offline player data corresponding to the management application in the memory pool.
其中,离线玩家数据管理器可以用于管理内存池,以及控制访问已放入内存池的离线玩家数据。Among them, the offline player data manager can be used to manage the memory pool, and control access to offline player data that has been put into the memory pool.
如果内存池中存在与管理申请对应的离线玩家数据,执行步骤204。If offline player data corresponding to the management application exists in the memory pool, step 204 is performed.
步骤204,将与管理申请对应的离线玩家数据反馈给玩家。Step 204, feeding back the offline player data corresponding to the management application to the player.
如果内存池中不存在与管理申请对应的离线玩家数据,执行步骤206。If there is no offline player data corresponding to the management application in the memory pool, step 206 is performed.
步骤206,从数据库中读取出与管理申请对应的离线玩家数据。Step 206, read offline player data corresponding to the management application from the database.
步骤208,将与管理申请对应的离线玩家数据存储到内存池中,并反馈给玩家。Step 208, storing the offline player data corresponding to the management application in the memory pool, and feeding it back to the player.
而且,上述离线玩家数据管理器还可以对内存池中的离线玩家数据进行清理,参照图3,示出了本发明实施例中一种离线玩家数据清理示意图。Moreover, the above-mentioned offline player data manager can also clean up the offline player data in the memory pool. Referring to FIG. 3 , it shows a schematic diagram of offline player data cleaning in an embodiment of the present invention.
步骤300,离线玩家数据管理器对内存池中的离线玩家数据进行轮询。Step 300, the offline player data manager polls the offline player data in the memory pool.
如果内存池中的某离线玩家数据在一个时间段内未被访问,执行步骤302。上述一个时间段可以根据实际情况进行设定,例如为一个星期或者一个月等。If the offline player data in the memory pool has not been accessed within a period of time, step 302 is executed. The aforementioned time period may be set according to actual conditions, for example, one week or one month.
步骤302,将一个时间段内未被访问的该离线玩家数据存储到数据库中,并从内存池中删除。Step 302: Store the offline player data that has not been accessed within a period of time into the database, and delete it from the memory pool.
如果内存池中的某离线玩家数据在一个时间段内被访问过,执行步骤304。上述一个时间段可以根据实际情况进行设定,例如为一天或者一个小时等。If some offline player data in the memory pool has been accessed within a period of time, step 304 is executed. The aforementioned time period can be set according to actual conditions, for example, one day or one hour.
步骤304,保留一个时间段内被访问过的该离线玩家数据在内存池中。Step 304, keep the offline player data accessed within a period of time in the memory pool.
需要说明的是,上述两个时间段可以相同也可以不同,可以根据实际情况进行设定。It should be noted that the above two time periods may be the same or different, and may be set according to actual conditions.
下面,主要以游戏为例,介绍一种数据管理方法。In the following, a data management method is introduced mainly by taking a game as an example.
首先介绍一下应用本发明实施例所述的数据管理方法进行数据管理的整体结构。Firstly, the overall structure of data management by applying the data management method described in the embodiment of the present invention is introduced.
客户端游戏是指官方搭建服务器,用户下载安装文件安装客户端后通过互联网连接到服务器后进行多人交互的网络游戏。网页游戏(WEB游戏)是指通过浏览器打开网页就可以进行,只需要少量点击即可以完成的游戏。Client game refers to an online game in which the official server is set up, and the user downloads the installation file to install the client and connects to the server through the Internet for multiplayer interaction. Web games (WEB games) refer to games that can be played by opening a web page through a browser, and can be completed with only a few clicks.
持续时间化网络游戏(简称“持续时间游戏”)是指玩家需要花费较长时间持续体验的网络游戏,例如大部分的客户端游戏。碎片时间化网络游戏(简称“碎片时间游戏”)是指玩家可以利用少量时间即可以得到丰富体验的网络游戏,例如社区类网页游戏。Duration-based online games (referred to as "duration games") refer to online games that players need to spend a long time continuously experiencing, such as most client games. Fragmented time-based online games (referred to as "fragmented time games") refer to online games in which players can enjoy a rich experience in a small amount of time, such as community web games.
本发明实施例中,可以将客户端游戏的时间持续化和网页游戏的时间碎片化结合起来,让玩家可以充分利用这些碎片时间,在持续时间化网络游戏的碎片时间中得到碎片时间化网络游戏的游戏体验。In the embodiment of the present invention, the time continuation of client games and the time fragmentation of web games can be combined, so that players can make full use of these fragmented times, and obtain fragmented time online games in the fragmented time of continuous online games gaming experience.
其中,将客户端游戏称为持续时间游戏,对应的服务器称为持续时间服务器,对应的客户端称为持续时间客户端,游戏中的数据称为持续时间数据;将网页游戏称为碎片时间游戏,对应的客户端称为碎片时间客户端,游戏中的数据称为碎片时间数据。Among them, the client game is called the duration game, the corresponding server is called the duration server, the corresponding client is called the duration client, and the data in the game is called the duration data; the web game is called the fragmented time game , the corresponding client is called fragment time client, and the data in the game is called fragment time data.
首先可以在持续时间游戏中开发一个碎片时间游戏,所述碎片时间游戏可以采用网页游戏的开发方式进行开发(因此,本发明实施例可以将所开发的碎片时间游戏认为是网页游戏,实质上其并非真正的网页游戏)。这两类游戏可以使用同一套数据进行不同的游戏体验,碎片时间游戏可以是不同于持续时间游戏的一种新的场景。例如,如果玩家在持续时间游戏中的场景为A,角色为a,角色数据为b,则该玩家在碎片时间游戏中的场景可以为B,角色也为a,角色数据同样为b,从而可以通过这两类游戏同步进行角色的养成。First of all, a fragmented time game can be developed in the duration game, and the fragmented time game can be developed in the way of developing a web game (thus, the embodiment of the present invention can consider the developed fragmented time game as a webpage game, in essence its Not really a browser game). These two types of games can use the same set of data for different game experiences, and fragmented time games can be a new scene different from continuous time games. For example, if the player’s scene in the duration game is A, the character is a, and the character data is b, then the player’s scene in the fragmented time game can be B, the character is also a, and the character data is also b, so that Through these two types of games, the development of characters is carried out simultaneously.
具体的,如图4所示,为本发明实施例中客户端游戏和网页游戏结合的整体结构图。Specifically, as shown in FIG. 4 , it is an overall structural diagram of the combination of the client game and the browser game in the embodiment of the present invention.
从图4中可以看出,持续时间游戏和碎片时间游戏结合之后,即可以在持续时间游戏的过程中进行碎片时间游戏。可以在原有的持续时间服务器和持续时间客户端的基础上,开发一个碎片时间客户端,并且可以在原有的持续时间服务器上开发一个碎片时间数据处理模块,用于处理碎片时间游戏中的碎片时间数据。As can be seen from Figure 4, after the duration game and the fragment time game are combined, the fragment time game can be played during the duration game. A fragmented time client can be developed on the basis of the original duration server and duration client, and a fragmented time data processing module can be developed on the original duration server to process the fragmented time data in the fragmented time game .
其中,持续时间客户端和碎片时间客户端可以通过同一个客户端软件实现,当用户在下载客户端软件之后,可以同时具有持续时间客户端和碎片时间客户端。碎片时间客户端可以为一些插件,这些插件可以临时存放,例如,如果玩家在加载之后可以将其删除,当然,也可以进行保存,本发明实施例对此并不加以限制。Wherein, the duration client and the fragment time client can be implemented by the same client software, and after the user downloads the client software, he can have the duration client and the fragment time client at the same time. Fragment time clients can be some plug-ins, which can be temporarily stored, for example, if the player can delete them after loading them, of course, they can also be saved, which is not limited in the embodiment of the present invention.
可以开发一个用于承载所述碎片时间客户端的子进程。当玩家在进行持续时间游戏的过程中,在持续时间客户端内可以以某种方式触发该承载子进程启动,通过该子进程可以展现碎片时间客户端;然后碎片时间客户端即可以持续时间客户端为中介(进程间通信的方式),与持续时间服务器进行数据交互,通过持续时间服务器中的碎片时间数据处理模块对碎片时间客户端的碎片时间数据进行处理。A subprocess for hosting the fragmented time client can be developed. When the player is playing the duration game, the host sub-process can be triggered in some way in the duration client to start, and the fragment time client can be displayed through this sub-process; then the fragment time client can be used for the duration client The terminal is an intermediary (the way of inter-process communication), which interacts with the duration server for data, and processes the fragment time data of the fragment time client through the fragment time data processing module in the duration server.
上述图4中的持续时间服务器中可以包括持续时间数据处理模块和碎片时间数据处理模块。本发明实施例中所提到的客户端游戏可以为上述的持续时间游戏,网页游戏可以为上述的碎片时间游戏;网页游戏的客户端(即网页客户端)可以为上述碎片时间客户端,客户端游戏的客户端可以为上述持续时间客户端;网页游戏的服务器(即网页服务器)可以为上述碎片时间数据处理模块,客户端游戏的服务器可以为上述持续时间数据处理模块,中枢服务器为上述的持续时间服务器;客户端数据可以为持续时间游戏中的数据,网页数据可以为碎片时间游戏中的数据,共用数据可以为运行游戏的角色数据(账户数据)。The above-mentioned duration server in FIG. 4 may include a duration data processing module and a fragment time data processing module. The client game mentioned in the embodiment of the present invention can be the above-mentioned duration game, and the webpage game can be the above-mentioned fragmented time game; the client (ie web client) of the webpage game can be the above-mentioned fragmented time client, and the client The client of the client game can be the above-mentioned duration client; the server of the web game (that is, the web server) can be the above-mentioned fragment time data processing module, the server of the client game can be the above-mentioned duration data processing module, and the central server can be the above-mentioned Duration server; the client data can be the data in the Duration game, the webpage data can be the data in the fragment time game, and the shared data can be the character data (account data) running the game.
综上所述,本发明实施例公开的一种数据管理方法,具有以下优点:In summary, a data management method disclosed in the embodiment of the present invention has the following advantages:
在客户端平台的服务器中创建固定容量的内存池,在服务器应用每次启动时,提前加载高频访问的离线用户数据至内存池中。在服务器应用运行过程中,当接收到在线用户对离线用户数据的管理申请时,在内存池中查询是否存在欲管理的离线用户数据,如果存在,将欲管理的离线用户数据(高频访问的离线用户数据)发送至在线用户终端,并保留欲管理的离线用户数据(高频访问的离线用户数据)在内存池中;如果不存在,从数据库中读取出欲管理的离线用户数据(低频访问的离线用户数据),加载到内存池中,再从内存池中发送欲管理的离线用户数据(低频访问的离线用户数据)至在线用户终端,将管理后的离线用户数据(低频访问的离线用户数据)存储到数据库中,并在内存池中删除该离线用户数据。提前将高频访问的离线用户数据加载和缓存在内存池中,对内存池中低频访问的离线用户数据在存储至数据库后从内存池中释放,高频访问的离线用户数据保留在内存池中,只将低频访问的离线用户数据保存到数据库中,减少了数据库端的存储压力。Create a fixed-capacity memory pool in the server of the client platform, and load frequently accessed offline user data into the memory pool in advance each time the server application is started. During the running of the server application, when an online user's application for offline user data management is received, it will query whether there is offline user data to be managed in the memory pool. If it exists, the offline user data to be managed (high-frequency access offline user data) to the online user terminal, and keep the offline user data to be managed (offline user data with high frequency access) in the memory pool; if it does not exist, read the offline user data to be managed from the database (low frequency access Offline user data accessed by users), loaded into the memory pool, and then the offline user data to be managed (offline user data with infrequent access) is sent from the memory pool to the online user terminal, and the managed offline user data (offline user data with infrequent access) User data) is stored in the database, and the offline user data is deleted in the memory pool. Load and cache frequently accessed offline user data in the memory pool in advance, store infrequently accessed offline user data in the memory pool and release it from the memory pool, and frequently access offline user data remain in the memory pool , only save offline user data accessed infrequently to the database, reducing the storage pressure on the database side.
而且,使用固定容量的内存池加载和缓存离线用户数据,内存池的容量固定,对其中的离线用户数据进行清除和将离线用户数据加载和缓存到内存池中,产生的内存碎片较少。如果利用动态容量的内存池加载和缓存离线用户数据,加载和缓存的离线用户数据越多,内存池的容量会越大,相对较大容量的内存池就会产生较多的内存碎片。Moreover, a memory pool with a fixed capacity is used to load and cache offline user data. The capacity of the memory pool is fixed. Clearing the offline user data therein and loading and caching the offline user data into the memory pool results in less memory fragmentation. If you use a memory pool with dynamic capacity to load and cache offline user data, the more offline user data you load and cache, the larger the capacity of the memory pool will be, and a memory pool with a relatively large capacity will generate more memory fragments.
使用固定容量的内存池加载和缓存离线用户数据,服务器端剩余内存的容量也固定,不会因为加载和缓存离线用户数据的内存池越来越大,造成服务器端剩余内存减小的情况,保证了服务器端用于应用运行的内存容量。Use a fixed-capacity memory pool to load and cache offline user data, and the capacity of the remaining memory on the server side is also fixed, so that the remaining memory on the server side will not decrease because the memory pool for loading and caching offline user data is getting larger and larger. The memory capacity used by the server side for application running.
因为产生的内存碎片较少,降低了服务器的运行风险(内存碎片越多,服务器异常宕机风险越高)。Because less memory fragments are generated, the running risk of the server is reduced (the more memory fragments, the higher the risk of abnormal server downtime).
同时,动态调节内存池中的离线用户数据,当高频访问离线用户数据变为低频访问离线用户数据时,可以及时对这些离线用户数据进行清理,提高了内存池的使用率。At the same time, the offline user data in the memory pool is dynamically adjusted. When high-frequency access to offline user data becomes low-frequency access to offline user data, these offline user data can be cleaned up in time, which improves the utilization rate of the memory pool.
进一步地,由于内存池中缓存离线用户数据,当服务器与数据库的连接断开时,离线用户数据可以安全存放在内存池中,当连接重新建立后,离线用户数据可以继续存入数据库中,降低了离线用户数据丢失的风险。Furthermore, since the offline user data is cached in the memory pool, when the connection between the server and the database is disconnected, the offline user data can be safely stored in the memory pool, and when the connection is re-established, the offline user data can continue to be stored in the database, reducing the The risk of offline user data loss is reduced.
实施例二Embodiment two
详细介绍本发明实施例公开的一种数据管理系统。A data management system disclosed in the embodiment of the present invention is introduced in detail.
参照图5,示出了本发明实施例中一种数据管理系统结构图。Referring to FIG. 5 , it shows a structural diagram of a data management system in an embodiment of the present invention.
所述一种数据管理系统,可以包括:The data management system may include:
加载模块200,接收模块202,验证模块204,查询模块206,读取存储模块208,发送保留模块210,以及,查询管理模块212。Loading module 200 , receiving module 202 , verifying module 204 , querying module 206 , reading storage module 208 , sending and saving module 210 , and querying management module 212 .
其中,所述验证模块204,可以包括:Wherein, the verification module 204 may include:
在线用户判断子模块2041,管理申请判断子模块2042,以及,确定子模块2043。An online user judging submodule 2041 , a management application judging submodule 2042 , and a determining submodule 2043 .
下面分别详细介绍各模块、各子模块的功能以及各模块、各子模块之间的关系。The functions of each module and each sub-module and the relationship between each module and each sub-module are introduced in detail below.
加载模块200,用于在服务器应用启动时,提前加载满足存储条件的离线用户数据至已创建的固定容量的内存池中。The loading module 200 is configured to load offline user data satisfying storage conditions into the created memory pool with fixed capacity in advance when the server application is started.
所述存储条件为离线用户数据的访问频率大于等于预定阈值。The storage condition is that the access frequency of offline user data is greater than or equal to a predetermined threshold.
接收模块202,用于在服务器应用运行过程中,接收在线用户对离线用户数据的管理申请。The receiving module 202 is configured to receive an online user's application for managing offline user data during the running of the server application.
所述管理申请与离线用户数据具有映射关系。The management application has a mapping relationship with offline user data.
验证模块204,用于验证所述在线用户和所述管理申请是否均具有对离线用户数据进行管理的权限。A verification module 204, configured to verify whether both the online user and the management application have the authority to manage offline user data.
优选的,所述验证模块204,可以包括:Preferably, the verification module 204 may include:
在线用户判断子模块2041,用于判断所述在线用户是否属于具有管理与所述管理申请对应的离线用户数据的权限的用户。The online user judging sub-module 2041 is configured to judge whether the online user belongs to a user with authority to manage offline user data corresponding to the management application.
管理申请判断子模块2042,用于当所述在线用户属于具有管理与所述管理申请对应的离线用户数据的权限的用户时,判断所述管理申请是否符合与所述管理申请对应的离线用户数据的管理条件。The management application judging sub-module 2042 is used for judging whether the management application conforms to the offline user data corresponding to the management application when the online user belongs to a user with authority to manage the offline user data corresponding to the management application management conditions.
所述管理条件包括离线用户数据中的各项数据是否允许被读取、修改和删除。The management conditions include whether each data in the offline user data is allowed to be read, modified and deleted.
确定子模块2043,用于当所述在线用户属于具有管理与所述管理申请对应的离线用户数据的权限的用户,且所述管理申请符合与所述管理申请对应的离线用户数据的管理条件时,确定所述在线用户和所述管理申请均具有对离线用户数据进行管理的权限;当所述在线用户不属于具有管理与所述管理申请对应的离线用户数据的权限的用户时,确定所述在线用户不具有对离线用户数据进行管理的权限;当所述管理申请不符合与所述管理申请对应的离线用户数据的管理条件时,确定所述管理申请均不具有对离线用户数据进行管理的权限。A determining submodule 2043, configured to be used when the online user belongs to a user with authority to manage the offline user data corresponding to the management application, and the management application meets the management conditions of the offline user data corresponding to the management application , determining that both the online user and the management application have the authority to manage offline user data; when the online user does not belong to a user with authority to manage offline user data corresponding to the management application, determine that Online users do not have the right to manage offline user data; when the management application does not meet the management conditions for offline user data corresponding to the management application, it is determined that none of the management applications has the right to manage offline user data authority.
查询模块206,用于当所述在线用户和所述管理申请均具有对离线用户数据进行管理的权限时,查询所述内存池中是否存在与所述管理申请对应的离线用户数据。The query module 206 is configured to query whether the offline user data corresponding to the management application exists in the memory pool when the online user and the management application both have the authority to manage offline user data.
读取存储模块208,用于在所述查询模块206查询所述内存池中是否存在与所述管理申请对应的离线用户数据之后,当所述内存池中不存在与所述管理申请对应的离线用户数据时,从数据库中读取出与所述管理申请对应的离线用户数据,并存储到所述内存池中。The reading storage module 208 is configured to, after the query module 206 inquires whether there is offline user data corresponding to the management application in the memory pool, when there is no offline user data corresponding to the management application in the memory pool For user data, offline user data corresponding to the management application is read from the database and stored in the memory pool.
发送保留模块210,用于当所述内存池中存在与所述管理申请对应的离线用户数据时,发送与所述管理申请对应的离线用户数据至在线用户终端,并保留与所述管理申请对应的离线用户数据在所述内存池中。Sending and retaining module 210, configured to send the offline user data corresponding to the management application to an online user terminal when there is offline user data corresponding to the management application in the memory pool, and reserve the data corresponding to the management application The offline user data is in the mempool.
查询管理模块212,用于依次查询所述内存池中的离线用户数据;如果所述内存池中的离线用户数据在第一预置时间段内未被访问,将在所述第一预置时间段内未被访问的离线用户数据存储至数据库中,并在所述内存池中删除;如果所述内存池中的离线用户数据在第二预置时间段内被访问过,保留在所述第二预置时间段内被访问过的离线用户数据至所述内存池中。The query management module 212 is configured to sequentially query the offline user data in the memory pool; if the offline user data in the memory pool is not accessed within a first preset time period, it will The offline user data that has not been accessed in the segment is stored in the database and deleted in the memory pool; if the offline user data in the memory pool has been accessed within the second preset time period, it is retained in the first The offline user data that has been accessed within a preset period of time is stored in the memory pool.
下面,主要以游戏为例,介绍游戏运行时的数据管理系统。In the following, the game is mainly used as an example to introduce the data management system when the game is running.
首先介绍一下应用本发明实施例所述的数据管理系统进行数据管理的整体结构。Firstly, the overall structure of data management using the data management system described in the embodiment of the present invention is introduced.
客户端游戏是指官方搭建服务器,用户下载安装文件安装客户端后通过互联网连接到服务器后进行多人交互的网络游戏。Client game refers to an online game in which the official server is set up, and the user downloads the installation file to install the client and connects to the server through the Internet for multiplayer interaction.
持续时间化网络游戏(简称“持续时间游戏”)是指玩家需要花费较长时间持续体验的网络游戏,例如大部分的客户端游戏。Duration-based online games (referred to as "duration games") refer to online games that players need to spend a long time continuously experiencing, such as most client games.
其中,将客户端游戏称为持续时间游戏,对应的服务器称为持续时间服务器,对应的客户端称为持续时间客户端,游戏中的数据称为持续时间数据。Wherein, the client game is called the duration game, the corresponding server is called the duration server, the corresponding client is called the duration client, and the data in the game is called the duration data.
具体的,如图6所示,为本发明实施例中客户端游戏中管理离线用户数据的结构示意图。Specifically, as shown in FIG. 6 , it is a schematic structural diagram of managing offline user data in a client game in an embodiment of the present invention.
从图6中可以看出,持续时间服务器中可以包括碎片时间数据处理模块。本发明实施例中所提到的客户端游戏可以为上述的持续时间游戏,客户端游戏的客户端可以为上述持续时间客户端;客户端游戏的服务器可以为上述的持续时间服务器。其中,碎片时间数据处理模块可以为上述加载模块200、查询模块206、读取存储模块208、发送保留模块210和查询管理模块212的结合体。It can be seen from FIG. 6 that the duration server may include a fragment time data processing module. The client game mentioned in the embodiment of the present invention may be the above-mentioned duration game, and the client of the client game may be the above-mentioned duration client; the server of the client game may be the above-mentioned duration server. Wherein, the fragment time data processing module may be a combination of the above-mentioned loading module 200 , query module 206 , read storage module 208 , sending reservation module 210 and query management module 212 .
综上所述,本发明实施例公开的一种数据管理系统,具有以下优点:To sum up, the data management system disclosed in the embodiment of the present invention has the following advantages:
在客户端平台的服务器中创建固定容量的内存池,在服务器应用每次启动时,提前加载高频访问的离线用户数据至内存池中。在服务器应用运行过程中,当接收到在线用户对离线用户数据的管理申请时,在内存池中查询是否存在欲管理的离线用户数据,如果存在,将欲管理的离线用户数据(高频访问的离线用户数据)发送至在线用户终端,并保留欲管理的离线用户数据(高频访问的离线用户数据)在内存池中;如果不存在,从数据库中读取出欲管理的离线用户数据(低频访问的离线用户数据),加载到内存池中,再从内存池中发送欲管理的离线用户数据(低频访问的离线用户数据)至在线用户终端,将管理后的离线用户数据(低频访问的离线用户数据)存储到数据库中,并在内存池中删除该离线用户数据。提前将高频访问的离线用户数据加载和缓存在内存池中,对内存池中低频访问的离线用户数据在存储至数据库后从内存池中释放,高频访问的离线用户数据保留在内存池中,只将低频访问的离线用户数据保存到数据库中,减少了数据库端的存储压力。Create a fixed-capacity memory pool in the server of the client platform, and load frequently accessed offline user data into the memory pool in advance each time the server application is started. During the running of the server application, when an online user's application for offline user data management is received, it will query whether there is offline user data to be managed in the memory pool. If it exists, the offline user data to be managed (high-frequency access offline user data) to the online user terminal, and keep the offline user data to be managed (offline user data with high frequency access) in the memory pool; if it does not exist, read the offline user data to be managed from the database (low frequency access Offline user data accessed by users), loaded into the memory pool, and then the offline user data to be managed (offline user data with infrequent access) is sent from the memory pool to the online user terminal, and the managed offline user data (offline user data with infrequent access) User data) is stored in the database, and the offline user data is deleted in the memory pool. Load and cache frequently accessed offline user data in the memory pool in advance, store infrequently accessed offline user data in the memory pool and release it from the memory pool, and frequently access offline user data remain in the memory pool , only save offline user data accessed infrequently to the database, reducing the storage pressure on the database side.
而且,使用固定容量的内存池加载和缓存离线用户数据,内存池的容量固定,对其中的离线用户数据进行清除和将离线用户数据加载和缓存到内存池中,产生的内存碎片较少。如果利用动态容量的内存池加载和缓存离线用户数据,加载和缓存的离线用户数据越多,内存池的容量会越大,相对较大容量的内存池就会产生较多的内存碎片。Moreover, a memory pool with a fixed capacity is used to load and cache offline user data. The capacity of the memory pool is fixed. Clearing the offline user data therein and loading and caching the offline user data into the memory pool results in less memory fragmentation. If you use a memory pool with dynamic capacity to load and cache offline user data, the more offline user data you load and cache, the larger the capacity of the memory pool will be, and a memory pool with a relatively large capacity will generate more memory fragments.
使用固定容量的内存池加载和缓存离线用户数据,服务器端剩余内存的容量也固定,不会因为加载和缓存离线用户数据的内存池越来越大,造成服务器端剩余内存减小的情况,保证了服务器端用于应用运行的内存容量。Use a fixed-capacity memory pool to load and cache offline user data, and the capacity of the remaining memory on the server side is also fixed, so that the remaining memory on the server side will not decrease because the memory pool for loading and caching offline user data is getting larger and larger. The memory capacity used by the server side for application running.
因为产生的内存碎片较少,降低了服务器的运行风险(内存碎片越多,服务器异常宕机风险越高)。Because less memory fragments are generated, the running risk of the server is reduced (the more memory fragments, the higher the risk of abnormal server downtime).
同时,动态调节内存池中的离线用户数据,当高频访问离线用户数据变为低频访问离线用户数据时,可以及时对这些离线用户数据进行清理,提高了内存池的使用率。At the same time, the offline user data in the memory pool is dynamically adjusted. When high-frequency access to offline user data becomes low-frequency access to offline user data, these offline user data can be cleaned up in time, which improves the utilization rate of the memory pool.
进一步地,由于内存池中缓存离线用户数据,当服务器与数据库的连接断开时,离线用户数据可以安全存放在内存池中,当连接重新建立后,离线用户数据可以继续存入数据库中,降低了离线用户数据丢失的风险。Furthermore, since the offline user data is cached in the memory pool, when the connection between the server and the database is disconnected, the offline user data can be safely stored in the memory pool, and when the connection is re-established, the offline user data can continue to be stored in the database, reducing the The risk of offline user data loss is reduced.
对于系统实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。As for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the related parts, please refer to the part of the description of the method embodiment.
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other.
以上对本发明实施例所公开的一种数据管理方法和系统,进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The data management method and system disclosed in the embodiments of the present invention have been introduced in detail above. In this paper, specific examples are used to illustrate the principle and implementation of the present invention. The descriptions of the above embodiments are only used to help understand the present invention. The method of the invention and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and scope of application. In summary, the content of this specification should not be understood To limit the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310182433.9A CN104166820B (en) | 2013-05-16 | 2013-05-16 | A kind of data managing method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310182433.9A CN104166820B (en) | 2013-05-16 | 2013-05-16 | A kind of data managing method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104166820A CN104166820A (en) | 2014-11-26 |
CN104166820B true CN104166820B (en) | 2017-09-29 |
Family
ID=51910629
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310182433.9A Expired - Fee Related CN104166820B (en) | 2013-05-16 | 2013-05-16 | A kind of data managing method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104166820B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106973148A (en) * | 2017-03-08 | 2017-07-21 | 东莞市秦川文化传播有限公司 | A news offline reading terminal |
CN107222499A (en) * | 2017-07-04 | 2017-09-29 | 四川云物益邦科技有限公司 | File management method based on offline storage technology |
CN112784288B (en) * | 2021-01-22 | 2024-05-10 | 尚娱软件(深圳)有限公司 | Access management method, terminal and computer readable storage medium |
CN116136882A (en) * | 2021-11-17 | 2023-05-19 | 腾讯科技(深圳)有限公司 | Data processing method, device, electronic device, and computer-readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1508703A (en) * | 2002-12-18 | 2004-06-30 | 华为技术有限公司 | A database access method and client/server system for realizing the method |
CN202025314U (en) * | 2010-09-17 | 2011-11-02 | 北京开心人信息技术有限公司 | High-efficiency cache system of server |
CN102609476A (en) * | 2012-01-19 | 2012-07-25 | 北京神州数码思特奇信息技术股份有限公司 | Method for managing data of handheld business hall |
CN102724295A (en) * | 2012-05-24 | 2012-10-10 | 中国电子科技集团公司第十五研究所 | Data synchronization method and system |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9003543B2 (en) * | 2010-12-21 | 2015-04-07 | Microsoft Technology Licensing, Llc | Providing a security boundary |
-
2013
- 2013-05-16 CN CN201310182433.9A patent/CN104166820B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1508703A (en) * | 2002-12-18 | 2004-06-30 | 华为技术有限公司 | A database access method and client/server system for realizing the method |
CN202025314U (en) * | 2010-09-17 | 2011-11-02 | 北京开心人信息技术有限公司 | High-efficiency cache system of server |
CN102609476A (en) * | 2012-01-19 | 2012-07-25 | 北京神州数码思特奇信息技术股份有限公司 | Method for managing data of handheld business hall |
CN102724295A (en) * | 2012-05-24 | 2012-10-10 | 中国电子科技集团公司第十五研究所 | Data synchronization method and system |
Also Published As
Publication number | Publication date |
---|---|
CN104166820A (en) | 2014-11-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105205014B (en) | A kind of date storage method and device | |
US20080271130A1 (en) | Minimizing client-side inconsistencies in a distributed virtual file system | |
US8886752B2 (en) | System and method for optimizing transfers of downloadable content | |
WO2017185616A1 (en) | File storage method and electronic equipment | |
CN101916289B (en) | Method for establishing digital library storage system supporting mass small files and dynamic backup number | |
CN110191168A (en) | Online business data processing method, device, computer equipment and storage medium | |
CN105872016A (en) | Operation method of virtual machine in desktop cloud | |
CN105653198A (en) | Data processing method and device | |
CN104166820B (en) | A kind of data managing method and system | |
CN101277211A (en) | Method and apparatus for buffering data | |
CN110737682A (en) | cache operation method, device, storage medium and electronic equipment | |
CN102572545A (en) | Cloud computing based video service and playing methods | |
CN109471843A (en) | Metadata caching method, system and related device | |
CN108875046A (en) | A kind of storage system access method, device and electronic equipment | |
CN108228390A (en) | Data return shelves method and device | |
WO2014146441A1 (en) | Method, server and system for processing task data | |
CN102411631A (en) | A Method for Embedded Browser Disk Cache | |
CN103200272A (en) | Streaming media storage system and storage method | |
CN104424116B (en) | A kind of method and system of built-in browser disk buffering | |
CN107633102A (en) | A kind of method, apparatus, system and equipment for reading metadata | |
US10140332B2 (en) | Method and system for data cache handling | |
CN110837573B (en) | Distributed audio file storage and reading method and system | |
CN105824820A (en) | Media file buffer memory method and device | |
CN112433848A (en) | Resource processing method, device, storage medium and cache server | |
CN116821072A (en) | Dynamic caching method, device, equipment and storage medium for files |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170929 |