







技术领域technical field
本公开涉及互联网技术领域,尤其涉及一种数据处理方法、装置、电子设备及存储介质。The present disclosure relates to the field of Internet technologies, and in particular, to a data processing method, apparatus, electronic device, and storage medium.
背景技术Background technique
随着当前的移动互联网的迅速发展,客户端和后端数据库之间存在着大量的数据交互。现有技术中,当客户端对数据库进行数据读取时,一般先读取缓存中的数据,当缓存中不存在该数据时,可以去数据库中读取数据。这样做的目标是为了减少对数据库的请求,使得尽可能多的请求可以在缓存中得到结果。With the rapid development of the current mobile Internet, there is a large amount of data interaction between the client and the back-end database. In the prior art, when a client reads data from a database, the data in the cache is generally read first, and when the data does not exist in the cache, the data can be read from the database. The goal of this is to reduce requests to the database so that as many requests as possible get results in the cache.
然而,一些网络攻击行为中,其请求无论是在缓存中还是在数据库中都没有对应的数据,按照上述的流程,最终都会走到数据库这个环节,对数据库造成较大压力,影响数据库性能。However, in some network attacks, the request does not have corresponding data in the cache or in the database. According to the above process, it will eventually reach the link of the database, which will cause great pressure on the database and affect the performance of the database.
发明内容SUMMARY OF THE INVENTION
本公开提供一种数据处理方法、装置、电子设备及存储介质,本公开的技术方案如下:The present disclosure provides a data processing method, device, electronic device and storage medium, and the technical solutions of the present disclosure are as follows:
根据本公开实施例的第一方面,提供一种数据处理方法,包括:According to a first aspect of the embodiments of the present disclosure, there is provided a data processing method, including:
接收客户端的数据请求;数据请求包括账号标识;Receive the data request from the client; the data request includes the account ID;
确定数据请求所属的业务对应的缓存系统;业务为缓存系统对应的多个业务中的一个;Determine the cache system corresponding to the service to which the data request belongs; the service is one of multiple services corresponding to the cache system;
若基于账号标识从缓存系统中得到的数据为空值,则确定业务对应的数据库;If the data obtained from the cache system based on the account ID is null, the database corresponding to the business is determined;
若基于账号标识从数据库中得到的数据为空值,在缓存系统中创建账号标识和账号标识对应的预设占位数据;If the data obtained from the database based on the account ID is a null value, create the account ID and preset placeholder data corresponding to the account ID in the cache system;
向客户端发送预设占位数据。Send preset placeholder data to the client.
在一些可能的实施例中,向客户端发送预设占位数据后,还包括:In some possible embodiments, after sending the preset occupancy data to the client, the method further includes:
接收数据请求;数据请求包括账号标识;Receive data requests; data requests include account identifiers;
确定数据请求所属的业务对应的缓存系统;Determine the cache system corresponding to the business to which the data request belongs;
从缓存系统中获取预设占位数据;Obtain preset placeholder data from the cache system;
向客户端发送预设占位数据。Send preset placeholder data to the client.
在一些可能的实施例中,方法还包括:In some possible embodiments, the method further includes:
接收客户端的目标数据创建指令;目标数据创建指令包含账号标识;Receive the target data creation instruction from the client; the target data creation instruction includes the account ID;
确定目标数据创建指令所属的业务对应的数据库;Determine the database corresponding to the business to which the target data creation instruction belongs;
在数据库中创建账号标识和账号标识对应的目标数据;Create an account ID and target data corresponding to the account ID in the database;
在缓存系统中,利用目标数据覆盖预设占位数据。In the cache system, the preset placeholder data is overwritten with the target data.
在一些可能的实施例中,方法还包括:In some possible embodiments, the method further includes:
接收客户端的目标数据更新指令;目标数据更新指令包括账号标识和更新数据;Receive the target data update instruction of the client; the target data update instruction includes the account ID and the update data;
确定数据库;determine the database;
基于更新数据对账号标识对应的目标数据进行更新,得到更新后的目标数据;Based on the update data, update the target data corresponding to the account ID to obtain the updated target data;
删除缓存系统中的目标数据。Delete the target data in the cache system.
在一些可能的实施例中,删除缓存系统中的目标数据后,还包括:In some possible embodiments, after deleting the target data in the cache system, the method further includes:
接收客户端的数据请求;数据请求包括账号标识;Receive the data request from the client; the data request includes the account ID;
从缓存系统中获取的账号标识对应的数据为空值;The data corresponding to the account ID obtained from the cache system is null;
从数据库中获取的账号标识对应的数据为更新后的目标数据;The data corresponding to the account ID obtained from the database is the updated target data;
将更新后的目标数据作为账号标识对应的数据存储在缓存系统中;Store the updated target data in the cache system as the data corresponding to the account ID;
将更新后的目标数据反馈至客户端。Feed back the updated target data to the client.
在一些可能的实施例中,在缓存系统中,利用目标数据覆盖预设占位数据包括:In some possible embodiments, in the cache system, overwriting the preset placeholder data with the target data includes:
向缓存系统发送数据覆盖指令;数据覆盖指令包括目标数据和账号标识;数据覆盖指令用于指示缓存系统用目标数据覆盖预设占位数据;Send a data coverage instruction to the cache system; the data coverage instruction includes target data and an account identifier; the data coverage instruction is used to instruct the cache system to overwrite the preset occupancy data with the target data;
在目标数据覆盖预设占位数据失败的情况下,删除缓存系统中的预设占位数据;If the target data fails to overwrite the preset placeholder data, delete the preset placeholder data in the cache system;
将数据覆盖指令存放于消息队列中,以使消息队列对应的消费端向缓存系统发送数据覆盖指令。The data coverage instruction is stored in the message queue, so that the consumer end corresponding to the message queue sends the data coverage instruction to the cache system.
在一些可能的实施例中,删除缓存系统中的预设占位数据之后,还包括:In some possible embodiments, after deleting the preset occupancy data in the cache system, the method further includes:
接收数据请求;数据请求包括账号标识;Receive data requests; data requests include account identifiers;
从缓存系统中获取的账号标识对应的数据为空值;The data corresponding to the account ID obtained from the cache system is null;
从数据库中获取的账号标识对应的数据为目标数据。The data corresponding to the account identifier obtained from the database is the target data.
根据本公开实施例的第二方面,提供一种数据处理装置,包括:According to a second aspect of the embodiments of the present disclosure, there is provided a data processing apparatus, including:
接收模块,被配置为执行接收客户端的数据请求;数据请求包括账号标识;The receiving module is configured to execute the data request of the receiving client; the data request includes the account identifier;
缓存系统确定模块,被配置为执行确定数据请求所属的业务对应的缓存系统;业务为缓存系统对应的多个业务中的一个;The cache system determination module is configured to execute the cache system corresponding to the service to which the data request belongs; the service is one of multiple services corresponding to the cache system;
数据库确定模块,被配置为执行若基于账号标识从缓存系统中得到的数据为空值,则确定业务对应的数据库;The database determination module is configured to determine the database corresponding to the business if the data obtained from the cache system based on the account identifier is a null value;
占位数据创建模块,被配置为执行若基于账号标识从数据库中得到的数据为空值,在缓存系统中创建账号标识和账号标识对应的预设占位数据;The placeholder data creation module is configured to execute, if the data obtained from the database based on the account ID is a null value, create preset placeholder data corresponding to the account ID and the account ID in the cache system;
发送模块,被配置为执行向客户端发送预设占位数据。The sending module is configured to execute sending preset occupancy data to the client.
在一些可能的实施例中,装置还包括:In some possible embodiments, the apparatus further includes:
接收模块,被配置为执行接收数据请求;数据请求包括账号标识;a receiving module, configured to execute a request for receiving data; the data request includes an account identifier;
缓存确定模块,被配置为执行确定数据请求所属的业务对应的缓存系统;The cache determination module is configured to execute the cache system corresponding to the service to which the data request belongs;
占位数据获取模块,被配置为执行从缓存系统中获取预设占位数据;The occupancy data acquisition module is configured to execute the acquisition of preset occupancy data from the cache system;
发送模块,被配置为执行向客户端发送预设占位数据。The sending module is configured to execute sending preset occupancy data to the client.
在一些可能的实施例中,装置还包括:In some possible embodiments, the apparatus further includes:
接收模块,被配置为执行接收客户端的目标数据创建指令;目标数据创建指令包含账号标识;The receiving module is configured to execute the target data creation instruction of the receiving client; the target data creation instruction includes the account identifier;
数据库确定模块,被配置为执行确定目标数据创建指令所属的业务对应的数据库;a database determination module, configured to execute a database corresponding to the business to which the target data creation instruction belongs;
目标数据创建模块,被配置为执行在数据库中创建账号标识和账号标识对应的目标数据;The target data creation module is configured to execute the creation of target data corresponding to the account ID and the account ID in the database;
目标数据覆盖模块,被配置为执行在缓存系统中,利用目标数据覆盖预设占位数据。The target data overwriting module is configured to be executed in the cache system and overwrite the preset occupancy data with the target data.
在一些可能的实施例中,装置还包括:In some possible embodiments, the apparatus further includes:
接收模块,被配置为执行接收客户端的目标数据更新指令;目标数据更新指令包括账号标识和更新数据;The receiving module is configured to execute the target data update instruction of the receiving client; the target data update instruction includes the account identifier and the update data;
数据库确定模块,被配置为执行确定数据库;a database determination module configured to perform a database determination;
目标数据更新模块,被配置为执行基于更新数据对账号标识对应的目标数据进行更新,得到更新后的目标数据;a target data update module, configured to perform updating the target data corresponding to the account identifier based on the update data to obtain the updated target data;
目标数据删除模块,被配置为执行删除缓存系统中的目标数据。The target data deletion module is configured to perform deletion of target data in the cache system.
在一些可能的实施例中,装置还包括:In some possible embodiments, the apparatus further includes:
接收模块,被配置为执行接收客户端的数据请求;数据请求包括账号标识;The receiving module is configured to execute the data request of the receiving client; the data request includes the account identifier;
目标数据获取模块,被配置为执行从缓存系统中获取的账号标识对应的数据为空值;从数据库中获取的账号标识对应的数据为更新后的目标数据;The target data acquisition module is configured to execute that the data corresponding to the account identifier acquired from the cache system is null; the data corresponding to the account identifier acquired from the database is the updated target data;
目标数据存储模块,被配置为执行将更新后的目标数据作为账号标识对应的数据存储在缓存系统中;The target data storage module is configured to store the updated target data as the data corresponding to the account identifier in the cache system;
发送模块,被配置为执行将更新后的目标数据反馈至客户端。The sending module is configured to feed back the updated target data to the client.
在一些可能的实施例中,目标数据覆盖模块,被配置为执行:In some possible embodiments, the target data overlay module is configured to perform:
向缓存系统发送数据覆盖指令;数据覆盖指令包括目标数据和账号标识;数据覆盖指令用于指示缓存系统用目标数据覆盖预设占位数据;Send a data coverage instruction to the cache system; the data coverage instruction includes target data and an account identifier; the data coverage instruction is used to instruct the cache system to overwrite the preset occupancy data with the target data;
在目标数据覆盖预设占位数据失败的情况下,删除缓存系统中的预设占位数据;If the target data fails to overwrite the preset placeholder data, delete the preset placeholder data in the cache system;
将数据覆盖指令存放于消息队列中,以使消息队列对应的消费端向缓存系统发送数据覆盖指令。The data coverage instruction is stored in the message queue, so that the consumer end corresponding to the message queue sends the data coverage instruction to the cache system.
在一些可能的实施例中,接收模块,被配置为执行接收数据请求;数据请求包括账号标识;In some possible embodiments, the receiving module is configured to perform receiving a data request; the data request includes an account identifier;
目标数据获取模块,被配置为执行从缓存系统中获取的账号标识对应的数据为空值;从数据库中获取的账号标识对应的数据为目标数据。The target data acquisition module is configured to execute that the data corresponding to the account identifier acquired from the cache system is null; the data corresponding to the account identifier acquired from the database is the target data.
根据本公开实施例的第三方面,提供一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,处理器被配置为执行指令,以实现如上述第一方面中任一项的方法。According to a third aspect of the embodiments of the present disclosure, there is provided an electronic device, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the first aspect as described above any of the methods.
根据本公开实施例的第四方面,提供一种计算机可读存储介质,当计算机可读存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行本公开实施例的第一方面中任一项的方法。According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute the first aspect of the embodiments of the present disclosure any of the methods.
根据本公开实施例的第五方面,提供一种计算机程序产品,计算机程序产品包括计算机程序,计算机程序存储在可读存储介质中,计算机设备的至少一个处理器从可读存储介质读取并执行计算机程序,使得计算机设备执行本公开实施例的第一方面中任一项的方法。According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product, the computer program product includes a computer program, the computer program is stored in a readable storage medium, and at least one processor of the computer device reads and executes the computer program from the readable storage medium A computer program that causes a computer device to perform the method of any one of the first aspects of the embodiments of the present disclosure.
本公开的实施例提供的技术方案至少带来以下有益效果:The technical solutions provided by the embodiments of the present disclosure bring at least the following beneficial effects:
接收客户端的数据请求,数据请求包括账号标识,确定数据请求所属的业务对应的缓存系统,业务为缓存系统对应的多个业务中的一个,若基于账号标识从缓存系统中得到的数据为空值,则确定业务对应的数据库,若基于账号标识从数据库中得到的数据为空值,在缓存系统中创建账号标识和账号标识对应的预设占位数据,向客户端发送预设占位数据。本申请实施例中,通过在缓存系统中建立预设占位数据,使得后续的请求可以在缓存系统中得到反馈,避免了大量的攻击请求走到数据库的情况,可以减轻数据库的压力。Receive the data request from the client, the data request includes the account ID, and determine the cache system corresponding to the service to which the data request belongs. The service is one of multiple services corresponding to the cache system. If the data obtained from the cache system based on the account ID is null , the database corresponding to the service is determined, and if the data obtained from the database based on the account ID is null, create the account ID and the preset placeholder data corresponding to the account ID in the cache system, and send the preset placeholder data to the client. In the embodiment of the present application, by establishing preset occupancy data in the cache system, subsequent requests can be fed back in the cache system, avoiding the situation that a large number of attack requests go to the database, and reducing the pressure on the database.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理,并不构成对本公开的不当限定。The accompanying drawings, which are incorporated into and constitute a part of this specification, illustrate embodiments consistent with the present disclosure, and together with the description, serve to explain the principles of the present disclosure and do not unduly limit the present disclosure.
图1是根据一示例性实施例示出的一种应用环境的示意图;FIG. 1 is a schematic diagram of an application environment according to an exemplary embodiment;
图2是根据一示例性实施例示出的一种数据处理方法的流程图;FIG. 2 is a flowchart of a data processing method according to an exemplary embodiment;
图3是根据一示例性实施例示出的一种数据处理方法的流程图;3 is a flowchart of a data processing method according to an exemplary embodiment;
图4是根据一示例性实施例示出的一种数据创建的流程图;Fig. 4 is a flow chart of data creation according to an exemplary embodiment;
图5是根据一示例性实施例示出的一种数据更新的流程图;FIG. 5 is a flowchart of a data update according to an exemplary embodiment;
图6是根据一示例性实施例示出的一种数据获取的流程图;FIG. 6 is a flow chart of data acquisition according to an exemplary embodiment;
图7是根据一示例性实施例示出的一种数据处理装置的框图;7 is a block diagram of a data processing apparatus according to an exemplary embodiment;
图8是根据一示例性实施例示出的一种用于数据处理的电子设备的框图。Fig. 8 is a block diagram of an electronic device for data processing according to an exemplary embodiment.
具体实施方式Detailed ways
为了使本领域普通人员更好地理解本公开的技术方案,下面将结合附图,对本公开实施例中的技术方案进行清楚、完整地描述。In order to make those skilled in the art better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
需要说明的是,本公开的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的第一对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本公开的实施例能够以除了在这里图示或描述的那些以外的顺序实施。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。It should be noted that the terms "first", "second" and the like in the description and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar first objects, and are not necessarily used to describe a specific order or sequence. order. It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the disclosure described herein can be practiced in sequences other than those illustrated or described herein. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as recited in the appended claims.
本申请中有关用户的所有数据均是用户授权后的数据。All data about the user in this application is the data authorized by the user.
请参阅图1,图1是根据一示例性实施例示出的一种数据处理方法的应用环境的示意图,如图1所示,该应用环境可以包括服务器01和客户端02。其中,数据库可以承载在服务器01上,还可以独立于该服务器01,承载在数据库服务器上。Please refer to FIG. 1 , which is a schematic diagram of an application environment of a data processing method according to an exemplary embodiment. As shown in FIG. 1 , the application environment may include a
在一些可能的实施例中,上述的客户端02可以包括但不限于智能手机、台式计算机、平板电脑、笔记本电脑、智能音箱、数字助理、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、智能可穿戴设备等类型的客户端。也可以为运行于上述客户端的软体,例如应用程序、小程序等。可选的,客户端上运行的操作系统可以包括但不限于安卓系统、IOS系统、linux、windows、Unix等。In some possible embodiments, the above-mentioned
在一些可能的实施例中,服务器01接收客户端02的数据请求,数据请求包括账号标识,确定数据请求所属的业务对应的缓存系统,业务为缓存系统对应的多个业务中的一个。若基于账号标识从缓存系统中得到的数据为空值,则确定业务对应的数据库,若基于账号标识从数据库中得到的数据为空值,在缓存系统中创建账号标识和账号标识对应的预设占位数据,向客户端02发送预设占位数据。In some possible embodiments, the
可选的,服务器01可以包括是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN(Content Delivery Network,内容分发网络)、以及大数据和人工智能平台等基础云计算服务的云服务器。服务器上运行的操作系统可以包括但不限于安卓系统、IOS系统、linux、windows、Unix等。Optionally,
可选的,若数据库,缓存系统所在的服务器不是服务器01,则数据库或者缓存系统所在的服务器包括是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN(Content Delivery Network,内容分发网络)、以及大数据和人工智能平台等基础云计算服务的云服务器。服务器上运行的操作系统可以包括但不限于安卓系统、IOS系统、linux、windows、Unix等。Optionally, if the server where the database or cache system is located is not
图1所示的应用环境的示意图为一个可选的环境示意图。在另一些可能的实施例中,应用环境可以包括业务服务器01、客户端02、数据库服务器03和缓存系统04。其中,业务服务器01和客户端02之间存在链接,业务服务器01分别和数据库服务器03、缓存系统04之间存在链接。The schematic diagram of the application environment shown in FIG. 1 is an optional schematic diagram of the environment. In other possible embodiments, the application environment may include a
图2是根据一示例性实施例示出的一种数据处理方法的流程图,如图2所示,数据处理方法可以应用于服务器,也可以应用于其他节点设备,包括以下步骤:FIG. 2 is a flowchart of a data processing method according to an exemplary embodiment. As shown in FIG. 2, the data processing method can be applied to a server or other node devices, including the following steps:
在步骤S201中,接收客户端的数据请求;数据请求包括账号标识。In step S201, a data request from a client is received; the data request includes an account identifier.
本申请实施例中,服务器接收客户端发送的数据请求,该服务器可以是针对某个特定业务的业务服务器。比如,该服务器可以对接某个音乐应用程序,使得用户可以通过客户端上的音乐应用程序从该服务器获取某个音乐。该服务器可以对接某个社交应用程序,使得用户可以通过客户端上的社交应用程序从该服务器获取某些资讯信息。该服务器可以对接某个游戏应用程序,使得用户可以通过客户端上的社交应用程序从该服务器获取某些虚拟宠物的数据。下面以服务器为对接游戏应用程序的业务服务器为例进行本申请实施例中的阐述,其他应用场景请参考此游戏应用程序的业务服务器。In the embodiment of the present application, the server receives the data request sent by the client, and the server may be a service server for a specific service. For example, the server can be connected to a certain music application, so that the user can obtain certain music from the server through the music application on the client. The server can be connected to a social application, so that the user can obtain some information from the server through the social application on the client. The server can be connected to a certain game application, so that the user can obtain the data of some virtual pets from the server through the social application program on the client. In the following, the description in the embodiments of the present application is made by taking the server as the service server for docking with the game application as an example. For other application scenarios, please refer to the service server of the game application.
在一些可能的实施例中,服务器可以接收客户端的数据请求,该数据请求中携带有账号标识。可选的,账号标识可以包括用户的电话号码,邮箱,用户的账号信息,客户端的标识。In some possible embodiments, the server may receive a data request from the client, where the data request carries the account identifier. Optionally, the account identifier may include the user's phone number, email address, user account information, and client identifier.
在步骤S203中,确定数据请求所属的业务对应的缓存系统;业务为缓存系统对应的多个业务中的一个。In step S203, a cache system corresponding to the service to which the data request belongs is determined; the service is one of multiple services corresponding to the cache system.
在一个可选的实施例中,客户端的应用程序和业务服务器是一一对应的。也就是说,某个游戏应用程序存在专门的服务器和其对接,当服务器接收到数据请求时,就确定了数据请求所属的业务为该游戏应用程序对应的业务。In an optional embodiment, there is a one-to-one correspondence between the client's application program and the service server. That is to say, a certain game application has a dedicated server for docking with it, and when the server receives a data request, it determines that the service to which the data request belongs is the service corresponding to the game application.
在另一个可选的实施例中,客户端的应用程序和业务服务器不是一一对应的。比如,服务器可以为A应用程序提供服务,还可以为B应用程序提供服务。这种情况下,在数据请求中,不仅要携带账号标识,还需要携带有应用程序的标识。如此,当服务器接收到数据请求时,可以确定当前为哪个应用程序提供服务。In another optional embodiment, the application program of the client and the service server are not in a one-to-one correspondence. For example, the server can provide services for A application and can also provide services for B application. In this case, in the data request, it is necessary to carry not only the account ID, but also the ID of the application. In this way, when the server receives a data request, it can determine which application is currently serving.
本申请实施例中,缓存系统可以承载在该服务器中,也可以作为单独的设备独立于该服务器,但是只为该服务器提供的业务做数据存储。In the embodiment of the present application, the cache system may be carried in the server, or may be independent of the server as a separate device, but only store data for the services provided by the server.
本申请实施例中,缓存系统可以承载在该服务器中,也可以作为单独的设备独立于该服务器,但是可以为多个服务器提供的业务做数据存储。也就是说,当前的服务器只是缓存系统能够服务的其中一个服务器,即,该数据请求所属的业务可以为缓存系统对应的多个业务中的一个。In the embodiment of the present application, the cache system may be carried in the server, or may be independent of the server as a separate device, but may store data for services provided by multiple servers. That is to say, the current server is only one of the servers that the cache system can serve, that is, the service to which the data request belongs may be one of multiple services corresponding to the cache system.
基于此,当服务器接收数据请求后,可以直接确定数据请求所属的业务对应的缓存系统,或者基于应用程序的标识确定数据请求所属的业务对应的缓存系统。Based on this, after the server receives the data request, it can directly determine the cache system corresponding to the service to which the data request belongs, or determine the cache system corresponding to the service to which the data request belongs based on the identifier of the application program.
在一些可能的实施例中,上述的缓存系统可以是一个公共的缓存系统,为多个业务或者多个服务器提供数据缓存服务。可选的,缓存系统可以一个远程字典服务(RemoteDictionary Server,Redis)型的数据库,是一个键值对Key-value的存储系统。可选的,缓存系统可以一个memcached型的数据库,是一个键值对Key-value的存储系统。In some possible embodiments, the above-mentioned caching system may be a public caching system that provides data caching services for multiple services or multiple servers. Optionally, the cache system may be a remote dictionary service (RemoteDictionary Server, Redis) database, which is a key-value storage system for key-value pairs. Optionally, the cache system may be a memcached database, which is a key-value storage system for key-value pairs.
在步骤S205中,若基于账号标识从缓存系统中得到的数据为空值,则确定业务对应的数据库。In step S205, if the data obtained from the cache system based on the account identifier is a null value, the database corresponding to the service is determined.
本申请实施例中,当服务器确定业务对应的缓存系统,可以调用该缓存系统,将账号标识作为key,从缓存系统中获取Key对应的数据。可选的,假设从缓存系统中得到的数据为空值,可能是客户端还没有在数据库中创建账号标识对应的数据,因此,在缓存系统中也得不到账号标识对应的数据。可选的,假设从缓存系统中得到的数据为空值,还可能意味着数据库中存在该账号标识对应的数据,但由于一些原因,比如网络延时,集群抖动,不能很及时地在缓存系统中同步账号标识对应的数据,进而使得服务器在缓存系统中得不到账号标识对应的数据。本申请实施例中,空值是指服务器从缓存系统中得不到key对应的数据。In the embodiment of the present application, when the server determines the cache system corresponding to the service, the server may call the cache system, use the account identifier as the key, and obtain the data corresponding to the key from the cache system. Optionally, assuming that the data obtained from the cache system is null, it may be that the client has not created the data corresponding to the account ID in the database, so the data corresponding to the account ID cannot be obtained in the cache system. Optionally, assuming that the data obtained from the cache system is a null value, it may also mean that there is data corresponding to the account ID in the database, but due to some reasons, such as network delay and cluster jitter, the cache system cannot be stored in a timely manner. The data corresponding to the account identifier is synchronized in the cache system, so that the server cannot obtain the data corresponding to the account identifier in the cache system. In the embodiment of this application, the null value means that the server cannot obtain the data corresponding to the key from the cache system.
基于上述的原因,服务器可以确定业务对应的数据库,进一步地去判断是否可以从数据库中得到账号标识对应的数据。Based on the above reasons, the server can determine the database corresponding to the service, and further determine whether the data corresponding to the account identifier can be obtained from the database.
本申请实施例中,数据库可以承载在该服务器中,也可以作为单独的设备独立于该服务器,但是只为该服务器提供的业务做数据存储。In this embodiment of the present application, the database may be carried in the server, or may be independent of the server as a separate device, but only store data for the services provided by the server.
本申请实施例中,数据库可以承载在该服务器中,也可以作为单独的设备独立于该服务器,但是可以为多个服务器提供的业务做数据存储。也就是说,当前的服务器只是数据库能够服务的其中一个服务器,即,该数据请求所属的业务可以为数据库对应的多个业务中的一个。In the embodiment of the present application, the database may be carried in the server, or may be independent of the server as a separate device, but may store data for services provided by multiple servers. That is to say, the current server is only one of the servers that the database can serve, that is, the service to which the data request belongs may be one of multiple services corresponding to the database.
在步骤S207中,若基于账号标识从数据库中得到的数据为空值,在缓存系统中创建账号标识和账号标识对应的预设占位数据。In step S207, if the data obtained from the database based on the account identifier is a null value, the account identifier and preset placeholder data corresponding to the account identifier are created in the cache system.
本申请实施例中,当服务器确定业务对应的数据库,可以调用该数据库,将账号标识作为key,从数据库中获取Key对应的数据。可选的,假设从数据库中得到的数据为空值,可能是客户端还没有在数据库中创建账号标识对应的数据,因此,在数据库也得不到账号标识对应的数据。In the embodiment of the present application, when the server determines the database corresponding to the service, it can call the database, use the account identifier as the key, and obtain the data corresponding to the key from the database. Optionally, assuming that the data obtained from the database is a null value, it may be that the client has not created the data corresponding to the account ID in the database, so the data corresponding to the account ID cannot be obtained in the database.
此种情况下,客户端向服务器发送数据请求的操作可以是客户端对应的用户无意识做出的操作,也可能是网络攻击行为。但是,只要数据库中没有创建该账号标识对应的数据,服务器接收数据请求后,最终都会走到数据库查询数据这个环节,这势必会对数据库造成较大的压力,影响数据库性能,基于此,服务器可以在缓存系统中创建该账号标识(key)和该账号标识对应的预设占位数据(value)。In this case, the operation of the client sending a data request to the server may be an operation performed unconsciously by the user corresponding to the client, or may be a network attack. However, as long as the data corresponding to the account ID is not created in the database, after the server receives the data request, it will eventually go to the database query data link, which will inevitably cause greater pressure on the database and affect the performance of the database. Based on this, the server can The account identifier (key) and the preset occupancy data (value) corresponding to the account identifier are created in the cache system.
举个例子,假设服务器提供的业务是针对某个虚拟宠物的游戏应用程序,数据请求中包含账号信息XXXXXX123,若数据库中没有创建该账号标识对应的数据,则可以在缓存系统中设置该账号信息XXXXXX123以及账号信息对应的预设占位数据,预设占位数据可以包括虚拟宠物的标识,虚拟宠物的属性信息,该属性信息可以包括虚拟宠物的类型和等级等。此外,缓存系统中还可以存储账号标识,以及以键值对的形式保存账号标识和预设占位数据的关系。For example, suppose the service provided by the server is a game application for a certain virtual pet, and the data request contains account information XXXXXX123. If the data corresponding to the account ID is not created in the database, the account information can be set in the cache system. XXXXXX123 and preset occupancy data corresponding to account information, the preset occupancy data may include the identifier of the virtual pet, attribute information of the virtual pet, and the attribute information may include the type and level of the virtual pet. In addition, the cache system can also store the account identifier, and save the relationship between the account identifier and the preset placeholder data in the form of a key-value pair.
可选的,预设占位数据中的虚拟宠物的标识、虚拟宠物的类型和等级都可以是预设的。其中,预设占位数据中的虚拟宠物的标识,类型和等级可以是正常创建的虚拟宠物不能用的标识,类型和等级。比如,类型为“-1”,等级为“-1”。Optionally, the identifier of the virtual pet, the type and level of the virtual pet in the preset occupancy data may be preset. Wherein, the identifier, type and level of the virtual pet in the preset occupancy data may be an identifier, type and level that cannot be used by a normally created virtual pet. For example, type is "-1" and level is "-1".
在步骤S209中,向客户端发送预设占位数据。In step S209, preset occupancy data is sent to the client.
可选的,当服务器在缓存系统中创建账号标识对应的预设占位数据后,可以直接将该预设占位数据发送给客户端。Optionally, after the server creates preset occupancy data corresponding to the account identifier in the cache system, the server may directly send the preset occupancy data to the client.
可选的,当服务器在缓存系统中创建账号标识对应的预设占位数据后,可以向客户端发送一个反馈信息,该反馈信息表征该账号标识没有对应的数据。Optionally, after the server creates preset occupancy data corresponding to the account identifier in the cache system, it may send a feedback message to the client, where the feedback information indicates that the account identifier has no corresponding data.
在一些可能的实施例中,服务器在缓存系统中创建预设占位数据后,可能再次收到包含有该账号标识的数据请求,可选的,服务器可以直接读取预设占位数据反馈给客户端。In some possible embodiments, after the server creates the preset occupancy data in the cache system, it may receive a data request containing the account identifier again. Optionally, the server may directly read the preset occupancy data and feed it back to client.
图3是根据一示例性实施例示出的一种数据处理方法的流程图,如图3所示,在步骤 S209之后,可以包括以下步骤:Fig. 3 is a flowchart of a data processing method according to an exemplary embodiment. As shown in Fig. 3, after step S209, the following steps may be included:
在步骤S301中,接收数据请求,数据请求包括账号标识。In step S301, a data request is received, and the data request includes an account identifier.
在步骤S303中,确定数据请求所属的业务对应的缓存系统。In step S303, the cache system corresponding to the service to which the data request belongs is determined.
在步骤S305中,从缓存系统中获取预设占位数据。In step S305, the preset occupancy data is obtained from the cache system.
在步骤S307中,向客户端发送预设占位数据。In step S307, preset occupancy data is sent to the client.
本申请实施例中,服务器接收客户端发送的数据请求,从该数据请求中解析得到账号标识,服务器可以直接确定数据请求所属的业务对应的缓存系统,或者基于应用程序的标识确定数据请求所属的业务对应的缓存系统。由于此前已经在缓存系统中创建该账号标识对应的预设占位数据,因此,服务器可以从缓存系统中读取预设占位数据,而不是从数据库中读取数据。随后,服务器可以直接将该预设占位数据发送给客户端,也可以向客户端发送一个反馈信息,该反馈信息表征该账号标识没有对应的数据。In this embodiment of the present application, the server receives the data request sent by the client, and parses the data request to obtain the account identifier. The server can directly determine the cache system corresponding to the service to which the data request belongs, or determine the data request based on the identifier of the application program. The cache system corresponding to the business. Since the preset placeholder data corresponding to the account ID has been created in the cache system before, the server can read the preset placeholder data from the cache system instead of reading the data from the database. Subsequently, the server may directly send the preset occupancy data to the client, or may send a feedback message to the client, where the feedback information indicates that the account identifier has no corresponding data.
由于缓存系统中已经存在预设占位数据,因此,数据请求直接可以在缓存系统中获取数据,并反馈至客户端,不用走到数据库,这可以减轻数据库面对的数据请求量,从而保证数据库的性能。Since there is already preset occupancy data in the cache system, data requests can directly obtain data in the cache system and feed back to the client without going to the database, which can reduce the amount of data requests faced by the database and ensure that the database performance.
图4是根据一示例性实施例示出的一种数据创建的流程图,如图4所示,在步骤S209 或者步骤S307之后,包括以下步骤:Fig. 4 is a flow chart of data creation according to an exemplary embodiment. As shown in Fig. 4, after step S209 or step S307, the following steps are included:
在步骤S401中,接收客户端的目标数据创建指令;目标数据创建指令包含账号标识。In step S401, a target data creation instruction from the client is received; the target data creation instruction includes an account identifier.
本申请实施例中,服务器接收客户端发送的目标数据创建指令,可以从该目标数据创建指令中解析得到账号标识。In this embodiment of the present application, the server receives the target data creation instruction sent by the client, and can obtain the account identifier by parsing the target data creation instruction.
在步骤S403中,确定目标数据创建指令所属的业务对应的数据库。In step S403, the database corresponding to the business to which the target data creation instruction belongs is determined.
由于服务器接收的是基于同一个应用程序发送的目标数据创建指令,或者可以称为写指令,服务器可以确定目标数据创建指令所属的业务对应的数据库。Since what the server receives is based on the target data creation instruction sent by the same application, or can be called a write instruction, the server can determine the database corresponding to the business to which the target data creation instruction belongs.
在步骤S405中,在数据库中创建账号标识和账号标识对应的目标数据。In step S405, the account ID and target data corresponding to the account ID are created in the database.
可选的,当服务器接收到目标数据创建指令后,可以获取该账号标识对应的初始数据,以游戏应用程序举例,比如虚拟宠物的初始数据包括虚拟宠物的宠物标识(比如随机产生的数字或者文字,且和其他虚拟宠物的宠物标识不相同),包括虚拟宠物的类型(比如“0”,“0”表示类型待定),还可以包括虚拟宠物的等级(比如“0”,该“0”表示初始等级)。并将该初始数据作为目标数据存储在数据库中,此外,数据库中还可以保存账号标识,并以键值对的形式保存该账号标识和目标数据的关系。Optionally, after the server receives the target data creation instruction, it can obtain the initial data corresponding to the account ID. Taking a game application as an example, for example, the initial data of the virtual pet includes the pet ID of the virtual pet (such as a randomly generated number or text). , and is different from the pet identification of other virtual pets), including the type of the virtual pet (such as "0", "0" means the type is pending), and may also include the level of the virtual pet (such as "0", the "0" means initial level). The initial data is stored in the database as target data. In addition, the account identifier can also be stored in the database, and the relationship between the account identifier and the target data can be stored in the form of a key-value pair.
在步骤S407中,在缓存系统中,利用目标数据覆盖预设占位数据。In step S407, in the cache system, the preset occupancy data is overwritten with the target data.
由于此时缓存系统中,该账号标识对应的数据还是预设占位数据,若此时服务器接收到针对该账号标识的数据请求,则依然会反馈预设占位数据,这显然是不合理的。基于此,服务器在数据库中创建账号标识对应的目标数据后,可以,基于目标数据在缓存系统中,对预设占位数据进行覆盖,使得缓存系统中该账号标识对应的也是同样的目标数据。Since in the cache system at this time, the data corresponding to the account ID is still the preset occupancy data, if the server receives a data request for the account ID at this time, it will still feed back the preset occupancy data, which is obviously unreasonable. . Based on this, after the server creates the target data corresponding to the account identifier in the database, it may, based on the target data, overwrite the preset occupancy data in the cache system, so that the account identifier in the cache system corresponds to the same target data.
一些可能的实施例中,可以在数据库中设置监听组件binlog,用于对数据库中的插入事件进行监听。当数据库有插入事件时,监听组件可以获取此条目标数据,确定账号标识对应的预设占位数据,利用目标数据对预设占位数据进行覆盖。In some possible embodiments, a monitoring component binlog may be set in the database to monitor insertion events in the database. When there is an insertion event in the database, the monitoring component can obtain the target data, determine the preset placeholder data corresponding to the account ID, and use the target data to overwrite the preset placeholder data.
另一些可能的实施例中,服务器在数据库中创建账号标识对应的目标数据之后,可以向缓存系统发送数据覆盖指令。数据覆盖指令包括目标数据和账号标识,数据覆盖指令可以用于指示缓存系统用目标数据覆盖预设占位数据。可选的,在目标数据覆盖预设占位数据失败的情况下,可以删除缓存系统中的预设占位数据,并且,可以将数据覆盖指令存放于消息队列中,以使消息队列对应的消费端向缓存系统发送数据覆盖指令。In other possible embodiments, after the server creates the target data corresponding to the account identifier in the database, the server may send a data coverage instruction to the cache system. The data overwriting instruction includes target data and an account identifier, and the data overwriting instruction may be used to instruct the cache system to overwrite the preset occupancy data with the target data. Optionally, in the case that the target data fails to overwrite the preset placeholder data, the preset placeholder data in the cache system can be deleted, and the data overwrite instruction can be stored in the message queue, so that the corresponding consumption of the message queue can be reduced. The end sends a data overwrite command to the cache system.
如此,当由于网络延时,集群抖动导致的数据覆盖指令发送失败,可以通过消息队列来保证数据覆盖指令的再次发送,实现缓存系统中的数据和数据库中的数据的统一,同时,删除缓存系统中的预设占位数据,还可以保证,若当前有请求账号标识对应的数据时,避免从缓存系统中获取错误的预设占位数据。In this way, when the data coverage command fails to be sent due to network delay and cluster jitter, the message queue can be used to ensure that the data coverage command is sent again, so as to achieve the unification of the data in the cache system and the data in the database, and at the same time, delete the cache system. It can also ensure that if there is data corresponding to the requested account ID, it can avoid obtaining the wrong preset placeholder data from the cache system.
在一些可能的实施例中,在删除缓存系统中的预设占位数据后,当接收到数据请求时,可以从数据请求中解析得到该账号数据。随后,确定该数据请求所属的业务对应的缓存系统。此时,由于缓存系统中的预设占位数据已经被删除了,从缓存系统中获取的账号标识对应的数据为空值。接着,服务器可以确定业务对应的数据库,从数据库获取账号标识对应的数据为目标数据。In some possible embodiments, after the preset occupancy data in the cache system is deleted, when a data request is received, the account data can be obtained by parsing the data request. Subsequently, the cache system corresponding to the service to which the data request belongs is determined. At this time, since the preset occupancy data in the cache system has been deleted, the data corresponding to the account identifier obtained from the cache system is null. Next, the server may determine the database corresponding to the service, and obtain the data corresponding to the account identifier from the database as the target data.
这样,即使目标数据覆盖缓存系统中的预设占位数据失败了,且数据覆盖指令还在消息队列时,客户端仍然可以从数据库获取准确的目标数据。In this way, even if the target data fails to overwrite the preset occupancy data in the cache system, and the data overwriting instruction is still in the message queue, the client can still obtain accurate target data from the database.
在数据库存在账号标识对应的目标数据后,可能还会对目标数据进行修改(比如删除某些字段,或者修改某些字段),基于此,图5是根据一示例性实施例示出的一种数据更新的流程图,如图5所示,在步骤S407之后,包括以下步骤:After the target data corresponding to the account identifier exists in the database, the target data may also be modified (such as deleting some fields, or modifying some fields). Based on this, FIG. 5 shows a data according to an exemplary embodiment. The updated flowchart, as shown in Figure 5, includes the following steps after step S407:
在步骤S501中,接收客户端的目标数据更新指令;目标数据更新指令包括账号标识和更新数据。In step S501, a target data update instruction from the client is received; the target data update instruction includes an account identifier and update data.
本申请实施例中,服务器接收客户端发送的目标数据更新指令,可以从该目标数据更新指令中解析得到账号标识和更新数据。更新数据可以包括要更新的字段以及在目标数据中的更新位置。In the embodiment of the present application, the server receives the target data update instruction sent by the client, and can obtain the account identifier and the update data by parsing the target data update instruction. The update data may include the fields to be updated and the update location in the target data.
在步骤S503中,确定数据库。In step S503, the database is determined.
由于服务器接收的是基于同一个应用程序发送的目标数据更新指令,服务器可以确定目标数据更新指令所属的业务(同一业务)对应的数据库。Since the server receives the target data update instruction sent based on the same application program, the server can determine the database corresponding to the service (same service) to which the target data update instruction belongs.
在步骤S505中,基于更新数据对账号标识对应的目标数据进行更新,得到更新后的目标数据。In step S505, the target data corresponding to the account identifier is updated based on the update data to obtain the updated target data.
在步骤S507中,删除缓存系统中的目标数据。In step S507, the target data in the cache system is deleted.
本申请实施例中,数据库中的数据可以是永久性的数据。缓存系统可以是公共的,需要对接多种业务,或者多个服务器,因此,考虑到缓存系统需要存储的数据量,其存储的数据可以是临时的。可选的,服务器在基于更新数据对账号标识对应的目标数据进行更新,得到更新后的目标数据之后,考虑到缓存系统的数据存储量,可以删除缓存系统中的目标数据。In this embodiment of the present application, the data in the database may be permanent data. The cache system can be public and needs to be connected to multiple services or multiple servers. Therefore, considering the amount of data that the cache system needs to store, the data stored in the cache system can be temporary. Optionally, after updating the target data corresponding to the account identifier based on the update data and obtaining the updated target data, the server may delete the target data in the cache system in consideration of the data storage capacity of the cache system.
在删除缓存系统中的目标数据之后,若服务器又接收到包含账号标识的数据请求,则可以从数据库中获取更新后的目标数据,并将更新后的目标数据保存至缓存系统中。图6 是根据一示例性实施例示出的一种数据获取的流程图,如图6所示,在步骤S507之后,包括以下步骤:After deleting the target data in the cache system, if the server receives a data request containing an account ID again, it can obtain the updated target data from the database, and save the updated target data in the cache system. Fig. 6 is a flow chart of data acquisition according to an exemplary embodiment. As shown in Fig. 6, after step S507, the following steps are included:
在步骤S601中,接收客户端的数据请求;数据请求包括账号标识。In step S601, a data request from a client is received; the data request includes an account identifier.
在步骤S603中,从缓存系统中获取的账号标识对应的数据为空值。In step S603, the data corresponding to the account identifier obtained from the cache system is a null value.
在步骤S605中,从数据库中获取的账号标识对应的数据为更新后的目标数据。In step S605, the data corresponding to the account identifier obtained from the database is the updated target data.
在步骤S607中,将更新后的目标数据作为账号标识对应的数据存储在缓存系统中。In step S607, the updated target data is stored in the cache system as the data corresponding to the account identifier.
在步骤S609中,将更新后的目标数据反馈至客户端。In step S609, the updated target data is fed back to the client.
本申请实施例中,服务器接收客户端发送的数据请求,从该数据请求中解析得到账号标识,服务器可以直接确定数据请求所属的业务对应的缓存系统,或者基于应用程序的标识确定数据请求所属的业务对应的缓存系统。In this embodiment of the present application, the server receives the data request sent by the client, and parses the data request to obtain the account identifier. The server can directly determine the cache system corresponding to the service to which the data request belongs, or determine the data request based on the identifier of the application program. The cache system corresponding to the business.
由于上文中,在数据库的目标数据更新后,已经将缓存系统中的目标数据进行了删除,因此,服务器从缓存系统中获取的账号标识对应的数据为空值。即服务器不能从缓存系统中获取该账号标识对应的数据。接着服务器可以确定出业务对应的数据库,并从数据库中获取的账号标识对应的数据为更新后的目标数据。为了使得后续接收到的数据请求不会因为缓存系统中没有更新后的目标数据,再次走到数据库,对数据库产生压力,可以将更新后的目标数据作为账号标识对应的数据存储在缓存系统中,同时,可以将更新后的目标数据反馈至客户端。As mentioned above, after the target data of the database is updated, the target data in the cache system has been deleted. Therefore, the data corresponding to the account identifier obtained by the server from the cache system is null. That is, the server cannot obtain the data corresponding to the account ID from the cache system. Then the server can determine the database corresponding to the service, and the data corresponding to the account identifier obtained from the database is the updated target data. In order to prevent the subsequent received data requests from going to the database again because there is no updated target data in the cache system and putting pressure on the database, the updated target data can be stored in the cache system as the data corresponding to the account ID. At the same time, the updated target data can be fed back to the client.
另一种可选的实施例中,当服务器基于更新数据对账号标识对应的目标数据进行更新,得到更新后的目标数据之后,可以利用更新后的目标数据对缓存系统中的目标数据进行覆盖,进而使得缓存系统和数据库中的数据保持统一。然而,考虑到缓存系统需要存储的数据量和缓存系统中存储的数据的临时性,可以对缓存系统中的数据存储情况进行监控,当缓存系统中的数据存储情况满足预设条件,可以将该数据进行删除。In another optional embodiment, when the server updates the target data corresponding to the account identifier based on the updated data, and after obtaining the updated target data, the updated target data can be used to overwrite the target data in the cache system, In turn, the data in the cache system and the database remain unified. However, considering the amount of data that the cache system needs to store and the temporary nature of the data stored in the cache system, the data storage situation in the cache system can be monitored. When the data storage situation in the cache system meets the preset conditions, the data is deleted.
可选的,存系统中的数据存储情况满足预设条件可以包括,预设时长内,服务器没有接收到针对该数据的数据请求。Optionally, the data storage condition in the storage system meeting the preset condition may include that the server does not receive a data request for the data within a preset time period.
综上,本申请实施例中,在数据库中没有创建账号标识对应的数据时,可以通过在缓存系统中建立预设占位数据,使得后续的请求可以在缓存系统中得到反馈,避免了大量的攻击请求走到数据库的情况,可以减轻数据库的压力。To sum up, in the embodiment of the present application, when the data corresponding to the account identifier is not created in the database, the preset occupancy data can be established in the cache system, so that subsequent requests can be fed back in the cache system, avoiding a large number of When the attack request goes to the database, the pressure on the database can be relieved.
图7是根据一示例性实施例示出的一种数据处理装置框图。参照图7,该装置包括指令接收模块701、缓存系统确定模块702、数据库确定模块703、占位数据创建模块704 和发送模块705。Fig. 7 is a block diagram of a data processing apparatus according to an exemplary embodiment. 7 , the apparatus includes an
接收模块701,被配置为执行接收客户端的数据请求;数据请求包括账号标识;The receiving
缓存系统确定模块702,被配置为执行确定数据请求所属的业务对应的缓存系统;业务为缓存系统对应的多个业务中的一个;The cache
数据库确定模块703,被配置为执行若基于账号标识从缓存系统中得到的数据为空值,则确定业务对应的数据库;The
占位数据创建模块704,被配置为执行若基于账号标识从数据库中得到的数据为空值,在缓存系统中创建账号标识和账号标识对应的预设占位数据;The placeholder
发送模块705,被配置为执行向客户端发送预设占位数据。The sending
在一些可能的实施例中,装置还包括:In some possible embodiments, the apparatus further includes:
接收模块,被配置为执行接收数据请求;数据请求包括账号标识;a receiving module, configured to execute a request for receiving data; the data request includes an account identifier;
缓存确定模块,被配置为执行确定数据请求所属的业务对应的缓存系统;The cache determination module is configured to execute the cache system corresponding to the service to which the data request belongs;
占位数据获取模块,被配置为执行从缓存系统中获取预设占位数据;The occupancy data acquisition module is configured to execute the acquisition of preset occupancy data from the cache system;
发送模块,被配置为执行向客户端发送预设占位数据。The sending module is configured to execute sending preset occupancy data to the client.
在一些可能的实施例中,装置还包括:In some possible embodiments, the apparatus further includes:
接收模块,被配置为执行接收客户端的目标数据创建指令;目标数据创建指令包含账号标识;The receiving module is configured to execute the target data creation instruction of the receiving client; the target data creation instruction includes the account identifier;
数据库确定模块,被配置为执行确定目标数据创建指令所属的业务对应的数据库;a database determination module, configured to execute a database corresponding to the business to which the target data creation instruction belongs;
目标数据创建模块,被配置为执行在数据库中创建账号标识和账号标识对应的目标数据;The target data creation module is configured to execute the creation of target data corresponding to the account ID and the account ID in the database;
目标数据覆盖模块,被配置为执行在缓存系统中,利用目标数据覆盖预设占位数据。The target data overwriting module is configured to be executed in the cache system and overwrite the preset occupancy data with the target data.
在一些可能的实施例中,装置还包括:In some possible embodiments, the apparatus further includes:
接收模块,被配置为执行接收客户端的目标数据更新指令;目标数据更新指令包括账号标识和更新数据;The receiving module is configured to execute the target data update instruction of the receiving client; the target data update instruction includes the account identifier and the update data;
数据库确定模块,被配置为执行确定数据库;a database determination module configured to perform a database determination;
目标数据更新模块,被配置为执行基于更新数据对账号标识对应的目标数据进行更新,得到更新后的目标数据;a target data update module, configured to perform updating the target data corresponding to the account identifier based on the update data to obtain the updated target data;
目标数据删除模块,被配置为执行删除缓存系统中的目标数据。The target data deletion module is configured to perform deletion of target data in the cache system.
在一些可能的实施例中,装置还包括:In some possible embodiments, the apparatus further includes:
接收模块,被配置为执行接收客户端的数据请求;数据请求包括账号标识;The receiving module is configured to execute the data request of the receiving client; the data request includes the account identifier;
目标数据获取模块,被配置为执行从缓存系统中获取的账号标识对应的数据为空值;从数据库中获取的账号标识对应的数据为更新后的目标数据;The target data acquisition module is configured to execute that the data corresponding to the account identifier acquired from the cache system is null; the data corresponding to the account identifier acquired from the database is the updated target data;
目标数据存储模块,被配置为执行将更新后的目标数据作为账号标识对应的数据存储在缓存系统中;The target data storage module is configured to store the updated target data as the data corresponding to the account identifier in the cache system;
发送模块,被配置为执行将更新后的目标数据反馈至客户端。The sending module is configured to feed back the updated target data to the client.
在一些可能的实施例中,目标数据覆盖模块,被配置为执行:In some possible embodiments, the target data overlay module is configured to perform:
向缓存系统发送数据覆盖指令;数据覆盖指令包括目标数据和账号标识;数据覆盖指令用于指示缓存系统用目标数数据覆盖预设占位数据;Send a data coverage instruction to the cache system; the data coverage instruction includes target data and an account ID; the data coverage instruction is used to instruct the cache system to overwrite the preset occupancy data with the target number data;
在目标数据覆盖预设占位数据失败的情况下,删除缓存系统中的预设占位数据;If the target data fails to overwrite the preset placeholder data, delete the preset placeholder data in the cache system;
将数据覆盖指令存放于消息队列中,以使消息队列对应的消费端向缓存系统发送数据覆盖指令。The data coverage instruction is stored in the message queue, so that the consumer end corresponding to the message queue sends the data coverage instruction to the cache system.
在一些可能的实施例中,接收模块,被配置为执行接收数据请求;数据请求包括账号标识;In some possible embodiments, the receiving module is configured to perform receiving a data request; the data request includes an account identifier;
目标数据获取模块,被配置为执行从缓存系统中获取的账号标识对应的数据为空值;从数据库中获取的账号标识对应的数据为目标数据。The target data acquisition module is configured to execute that the data corresponding to the account identifier acquired from the cache system is null; the data corresponding to the account identifier acquired from the database is the target data.
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the above-mentioned embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be described in detail here.
图8是根据一示例性实施例示出的一种用于数据处理的装置800的框图。例如,装置 800可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。FIG. 8 is a block diagram of an
参照图8,装置800可以包括以下一个或多个组件:处理组件802,存储器804,电力组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,以及通信组件816。8, the
处理组件802通常控制装置800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。The
存储器804被配置为存储各种类型的数据以支持在设备800的操作。这些数据的示例包括用于在装置800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
电源组件806为装置800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为装置800生成、管理和分配电力相关联的组件。
多媒体组件808包括在所述装置800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当装置800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/
传感器组件814包括一个或多个传感器,用于为装置800提供各个方面的状态评估。例如,传感器组件814可以检测到设备800的打开/关闭状态,组件的相对定位,例如所述组件为装置800的显示器和小键盘,传感器组件814还可以检测装置800或装置800 一个组件的位置改变,用户与装置800接触的存在或不存在,装置800方位或加速/减速和装置800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如CMOS或CCD 图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。
通信组件816被配置为便于装置800和其他设备之间有线或无线方式的通信。装置800可以接入基于通信标准的无线网络,如WiFi,运营商网络(如2G、3G、4G或5G),或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在示例性实施例中,装置800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment,
在示例性实施例中,还提供了一种包括指令的存储介质,例如包括指令的存储器804,上述指令可由装置800的处理器820执行以完成上述方法。可选地,存储介质可以是非临时性计算机可读存储介质,例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a storage medium including instructions, such as a
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111388831.7ACN114691729B (en) | 2021-11-22 | 2021-11-22 | Data processing method, device, electronic device and storage medium |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111388831.7ACN114691729B (en) | 2021-11-22 | 2021-11-22 | Data processing method, device, electronic device and storage medium |
| Publication Number | Publication Date |
|---|---|
| CN114691729Atrue CN114691729A (en) | 2022-07-01 |
| CN114691729B CN114691729B (en) | 2024-12-03 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202111388831.7AActiveCN114691729B (en) | 2021-11-22 | 2021-11-22 | Data processing method, device, electronic device and storage medium |
| Country | Link |
|---|---|
| CN (1) | CN114691729B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2024230770A1 (en)* | 2023-05-09 | 2024-11-14 | 北京字跳网络技术有限公司 | Cache determination method and apparatus, and device and storage medium |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6393415B1 (en)* | 1999-03-31 | 2002-05-21 | Verizon Laboratories Inc. | Adaptive partitioning techniques in performing query requests and request routing |
| EP2360571A2 (en)* | 2010-02-24 | 2011-08-24 | Hitachi, Ltd. | Reduction of I/O latency for writable copy-on-write snapshot function |
| CN110245153A (en)* | 2019-05-20 | 2019-09-17 | 平安银行股份有限公司 | Product data processing method, system, computer equipment and storage medium |
| CN111078733A (en)* | 2019-11-26 | 2020-04-28 | 金蝶软件(中国)有限公司 | Batch task processing method and device, computer equipment and storage medium |
| CN111970315A (en)* | 2019-05-20 | 2020-11-20 | 北京车和家信息技术有限公司 | Method, device and system for pushing message |
| CN113347257A (en)* | 2021-06-03 | 2021-09-03 | 中国联合网络通信集团有限公司 | Communication method, communication device, server and storage medium |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6393415B1 (en)* | 1999-03-31 | 2002-05-21 | Verizon Laboratories Inc. | Adaptive partitioning techniques in performing query requests and request routing |
| EP2360571A2 (en)* | 2010-02-24 | 2011-08-24 | Hitachi, Ltd. | Reduction of I/O latency for writable copy-on-write snapshot function |
| CN110245153A (en)* | 2019-05-20 | 2019-09-17 | 平安银行股份有限公司 | Product data processing method, system, computer equipment and storage medium |
| CN111970315A (en)* | 2019-05-20 | 2020-11-20 | 北京车和家信息技术有限公司 | Method, device and system for pushing message |
| CN111078733A (en)* | 2019-11-26 | 2020-04-28 | 金蝶软件(中国)有限公司 | Batch task processing method and device, computer equipment and storage medium |
| CN113347257A (en)* | 2021-06-03 | 2021-09-03 | 中国联合网络通信集团有限公司 | Communication method, communication device, server and storage medium |
| Title |
|---|
| 张果: ""面向可共享内容的网内缓存机制研究"", 《中国博士学位论文全文数据库(电子期刊)信息科技辑》, 15 June 2018 (2018-06-15)* |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2024230770A1 (en)* | 2023-05-09 | 2024-11-14 | 北京字跳网络技术有限公司 | Cache determination method and apparatus, and device and storage medium |
| Publication number | Publication date |
|---|---|
| CN114691729B (en) | 2024-12-03 |
| Publication | Publication Date | Title |
|---|---|---|
| CN105843615B (en) | Notification message processing method and device | |
| US20220400137A1 (en) | Widget display method and apparatus | |
| KR102628856B1 (en) | System for sharing contents between electronic devices and method for sharing contents in an electronic device | |
| CN106603667A (en) | Screen information sharing method and device | |
| US20180288155A1 (en) | Method and apparatus for managing a shared storage system | |
| CN112231727B (en) | Data processing method, device, electronic equipment, server and storage medium | |
| CN104899083A (en) | Application sharing method and device | |
| CN115118695B (en) | Message processing method, device, electronic device, and storage medium | |
| CN113111123A (en) | Cluster service calling method and device, electronic equipment, storage medium and product | |
| CN112925788A (en) | Data set management method, system, device, electronic equipment and storage medium | |
| US20160006787A1 (en) | Methods and devices for visiting a webpage | |
| CN109302341B (en) | Instant messaging method, instant messaging device, electronic equipment and storage medium | |
| CN112528185B (en) | Comment information display method, device, server, and terminal | |
| CN111314419B (en) | Network request method and device | |
| CN111049732B (en) | Push message display method and device, electronic equipment and medium | |
| CN109033393A (en) | Sticker processing method, device, storage medium and electronic equipment | |
| CN114691729A (en) | A data processing method, device, electronic device and storage medium | |
| CN106060138A (en) | Method and apparatus for updating data | |
| CN113535161B (en) | User interface generation method and device | |
| CN107168648B (en) | File storage method and device and terminal | |
| CN108549576A (en) | File monitoring method and device, electronic equipment and storage medium | |
| CN109522286B (en) | Processing method and device of file system | |
| CN112839065A (en) | Information processing method, device, first device, and storage medium | |
| CN110995767B (en) | Request processing method and device | |
| CN113868562A (en) | Resource acquisition method, device, system, electronic equipment and readable storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |