CN117176810A - Head portrait information processing method, device, server and storage medium - Google Patents

Head portrait information processing method, device, server and storage medium Download PDF

Info

Publication number
CN117176810A
CN117176810A CN202311266049.7A CN202311266049A CN117176810A CN 117176810 A CN117176810 A CN 117176810A CN 202311266049 A CN202311266049 A CN 202311266049A CN 117176810 A CN117176810 A CN 117176810A
Authority
CN
China
Prior art keywords
head portrait
address information
user
avatar
local cache
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.)
Pending
Application number
CN202311266049.7A
Other languages
Chinese (zh)
Inventor
李肖虎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202311266049.7A priority Critical patent/CN117176810A/en
Publication of CN117176810A publication Critical patent/CN117176810A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a head portrait information processing method, a head portrait information processing device, a server and a storage medium. Relates to the technical field of information processing. The method comprises the following steps: receiving a head portrait inquiry request sent by a service application, and analyzing the request to obtain a user head portrait identifier; determining whether corresponding head portrait address information exists in a local cache; if yes, acquiring the information from the local cache; if not, calling the head portrait management server to acquire the information from an external database, and storing the information into a local cache; and the service application analyzes the message information to acquire the head portrait address information, acquires the user head portrait from the object storage server according to the head portrait address information, and displays the user head portrait. The method of the application adopts a mode of inquiring in the local cache, can ensure timeliness and reduce the cost of resources, improves the response time of the user head portrait when each service is displayed, and reduces the pressure of the database to a certain extent.

Description

Head portrait information processing method, device, server and storage medium
Technical Field
The present application relates to the field of information processing technologies, and in particular, to a method, an apparatus, a server, and a storage medium for processing head portrait information.
Background
The user head portrait is used as an identity mark and personalized setting of the user, is widely used in various applications, such as address book, short text and image-text applications, has calling and displaying of the user head portrait when information and comment information are released in some applications, and belongs to static resources of high-frequency access.
The existing method generally adopts a head portrait inquiry mode based on a joint inspection mode, and adopts a database to inquire head portraits; it is also more common to use micro-services to perform head portrait queries.
However, the joint check mode increases the resource consumption and burden of the database, and consumes longer time, so that the whole response time is dragged, and for a micro-service system, the remote call frequency between the head portrait business service and the head portrait management service is increased, and the consumption of network overhead and resource overhead is caused.
Disclosure of Invention
The application provides a head portrait information processing method, a device, a server and a storage medium, which are used for solving the problems that a head portrait inquiry mode is not applicable and cannot respond quickly in the prior art.
In a first aspect, the present application provides a method for processing head portrait information, including:
receiving an avatar query request sent by a service application, analyzing the avatar query request, and obtaining a user avatar identifier to be queried;
determining whether head portrait address information corresponding to the user head portrait identification exists in a local cache;
if yes, acquiring the head portrait address information from the local cache;
if not, calling an avatar management server to acquire the avatar address information from an external database, and storing the avatar address information into the local cache;
generating corresponding message information according to the head portrait address information, and sending the message information to the service application, so that the service application can analyze the message information to obtain head portrait address information, obtain corresponding user head portraits from an object storage server according to the head portrait address information, and display the user head portraits;
the head portrait address information in the external database is that a business application sends a user head portrait to the object storage server for storage so that the object storage server feeds back the head portrait address information, and the business application sends the head portrait address information to the head portrait management server and the head portrait management server stores the head portrait address information to the external database.
In one possible design, the external database includes: a redis database and a mysql database; the calling the head portrait management server to acquire the head portrait address information from an external database comprises the following steps:
calling a head portrait management server to determine whether head portrait address information corresponding to the user head portrait identification exists in a redis database;
if yes, calling the head portrait management server to acquire the head portrait address information from a redis database;
if not, calling an avatar management server to acquire the avatar address information from the mysql database, and writing the avatar address information into the redis database.
In one possible design, determining whether there is avatar address information in the local cache corresponding to the user avatar identification includes:
acquiring a mapping relation between a head portrait identifier and head portrait address information pre-stored in the local cache;
matching the user head portrait identification with the mapping relation;
if the user head portrait identification is matched with the head portrait identification prestored in the mapping relation, determining that head portrait address information corresponding to the user head portrait identification exists in the local cache;
and if the user head portrait identification is not matched with the head portrait identification prestored in the mapping relation, determining that head portrait address information corresponding to the user head portrait identification does not exist in the local cache.
In a second aspect, the present application further provides a method for processing head portrait information, including:
receiving an avatar changing request sent by a service application, analyzing the avatar changing request, and obtaining avatar address information to be changed and a changing user identifier, wherein the avatar address information is obtained by the service application, and the service application sends the user avatar to be changed to an object storage server to store the avatar address information fed back by the object storage server;
and updating the head portrait address information corresponding to the change user identifier in an external database by using the head portrait address information.
In one possible design, the external database includes: a redis database and a mysql database; the updating the header address information corresponding to the changed user identifier in the external database by using the header address information comprises the following steps:
and updating the head portrait address information corresponding to the change user identifier in the redis database by using the head portrait address information, and updating the head portrait address information corresponding to the change user identifier in the mysql database by using the head portrait address information.
In one possible design, the method for processing head portrait information further includes:
and distributing the head portrait address information and the corresponding changed user identification to a server corresponding to the application associated with the business application by adopting an application program coordination service, so that the corresponding server updates the head portrait address information corresponding to the matched user identification by using the head portrait address information after determining that the user identification matched with the changed user identification exists in the local cache.
In one possible design, the method for processing head portrait information further includes:
receiving a head portrait newly-added request sent by a service application, analyzing the head portrait newly-added request, and acquiring a newly-added user identifier and newly-added head portrait address information;
and sending the new user identification and the new avatar address information to the external database so that the external database can store the new user identification and the new avatar address information in an associated mode.
In a third aspect, the present application provides an avatar information processing apparatus comprising:
the first receiving and transmitting unit is used for receiving an avatar query request sent by the service application;
the first acquisition unit is used for analyzing the head portrait inquiry request and acquiring a user head portrait identifier to be inquired;
the determining unit is used for determining whether the head portrait address information corresponding to the head portrait identifier of the user exists in the local cache;
the first processing unit is used for acquiring the head portrait address information from the local cache if yes;
the first processing unit is also used for calling the head portrait management server to acquire the head portrait address information from an external database and storing the head portrait address information into the local cache if not;
The first processing unit is also used for generating corresponding message information according to the head portrait address information;
the first receiving and transmitting unit is further used for transmitting the message information to the service application, so that the service application can analyze the message information to obtain head portrait address information, obtain corresponding user head portraits from an object storage server according to the head portrait address information, and display the user head portraits;
the head portrait address information in the external database is that a business application sends a user head portrait to the object storage server for storage so that the object storage server feeds back the head portrait address information, and the business application sends the head portrait address information to the head portrait management server and the head portrait management server stores the head portrait address information to the external database.
In a fourth aspect, the present application also provides an apparatus for processing head portrait information, including:
the second receiving and transmitting unit is used for receiving the head portrait change request sent by the service application;
the second acquisition unit is used for analyzing the head portrait change request, acquiring head portrait address information to be changed and a change user identifier, wherein the head portrait address information is that the business application sends the head portrait of the user to be changed to the object storage server to store the head portrait address information fed back by the object storage server;
And the second processing unit is used for updating the head portrait address information corresponding to the change user identification in an external database by using the head portrait address information.
In a fifth aspect, an embodiment of the present application provides a server, including: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions stored in the memory to implement the avatar information processing method as described above for the first aspect and the various possible designs of the first aspect or the second aspect and the various possible designs of the second aspect.
In a sixth aspect, embodiments of the present application provide a computer readable storage medium having stored therein computer executable instructions which, when executed by a processor, implement the head portrait information processing method according to the above first aspect and the various possible designs of the first aspect or the second aspect and the various possible designs of the second aspect.
In a seventh aspect, embodiments of the present application provide a computer program product comprising a computer program which, when executed by a processor, implements the head portrait information processing method as described above for the various possible designs of the first aspect and the second aspect and the various possible designs of the second aspect.
According to the head portrait information processing method, device, server and storage medium, the head portrait inquiry request sent by the service application is received, and the head portrait inquiry request is analyzed to obtain the head portrait identification of the user to be inquired; determining whether head portrait address information corresponding to the user head portrait identification exists in a local cache; if yes, acquiring the head portrait address information from the local cache; if not, calling an avatar management server to acquire the avatar address information from an external database, and storing the avatar address information into the local cache; generating corresponding message information according to the head portrait address information, and sending the message information to the service application, so that the service application can analyze the message information to obtain head portrait address information, obtain corresponding user head portraits from an object storage server according to the head portrait address information, and display the user head portraits; the head portrait address information in the external database is that the business application sends the user head portrait to the object storage server for storage so that the object storage server feeds back the head portrait address information, and the method of inquiring in the local cache is adopted, so that timeliness can be ensured, resource expenditure can be reduced, response time of the user head portrait in each business display can be prolonged, and pressure of the database can be reduced to a certain extent. Even if the head portrait address information does not exist in the local cache, the relevant head portrait address information can be acquired from an external database and backfilled into the local cache so as to facilitate subsequent head portrait inquiry.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic diagram of a network architecture of an avatar information processing method provided by the present application;
fig. 2 is a schematic flow chart of a method for processing head portrait information according to the present application;
fig. 3 is a flow chart of another method for processing head portrait information according to the present application;
fig. 4 is a flow chart of another method for processing head portrait information according to the present application;
fig. 5 is a flow chart of another method for processing head portrait information according to the present application;
fig. 6 is a schematic structural diagram of an avatar information processing device according to the present application;
fig. 7 is a schematic structural diagram of another head portrait information processing device provided by the present application;
fig. 8 is a block diagram of a server for implementing the head portrait information processing method of the present application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
In the technical scheme of the application, the related processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the information such as financial data or user data are in accordance with the regulations of related laws and regulations, and the public welfare is not violated. The user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of related data is required to comply with related laws and regulations and standards, and is provided with corresponding operation entries for the user to select authorization or rejection.
For a clear understanding of the technical solutions of the present application, the prior art solutions will be described in detail first.
The existing method generally adopts a head portrait inquiry mode based on a joint inspection mode, and adopts a database to inquire head portraits; it is also more common to use micro-services to perform head portrait queries.
However, the joint check mode increases the resource consumption and burden of the database, and consumes longer time, so that the whole response time is dragged, and for a micro-service system, the remote call frequency between the head portrait business service and the head portrait management service is increased, and the consumption of network overhead and resource overhead is caused. And the use level of users is increased, so that the pressure on databases and application services is higher and higher, and quick response cannot be realized.
Therefore, aiming at the problems that the head portrait inquiry mode is not applicable and cannot respond quickly in the prior art, the inventor finds out in the research, receives a head portrait inquiry request sent by a service application, analyzes the head portrait inquiry request, acquires a user head portrait identifier to be inquired, determines whether the head portrait address information corresponding to the user head portrait identifier exists in a local cache, and acquires the corresponding head portrait address information from the local cache if the head portrait address information exists; if the user head portrait is not available, head portrait address information is obtained from an external database, the head portrait address information is stored in a local cache, message information is further generated according to the head portrait address information and is sent to service application, the service application analyzes the message information to obtain the head portrait address information, the service application obtains corresponding user head portraits from an object storage server according to the head portrait address information and displays the corresponding user head portraits, and the method of inquiring in the local cache is adopted, so that timeliness can be ensured, resource expenditure can be reduced, response time of the user head portraits in displaying each service can be prolonged, and pressure of the database can be reduced to a certain extent. Even if the head portrait address information does not exist in the local cache, the relevant head portrait address information can be acquired from an external database and backfilled into the local cache so as to facilitate subsequent head portrait inquiry.
The inventor proposes the technical scheme of the embodiment of the application based on the creative discovery. The network architecture and application scenario of the header information processing method provided by the embodiment of the application are described below.
As shown in fig. 1, the network architecture corresponding to the method for processing the header information provided by the embodiment of the present application includes: a service server 101, a service application 102, an avatar management server 103, a rediss database 104, a mysql database 105, and an object storage server; the service application 102 sends an avatar query request, the service server 101 receives the avatar query request sent by the service application 102, analyzes the avatar query request and obtains the user avatar identification to be queried; determining whether head portrait address information corresponding to the head portrait identification of the user exists in the local cache; if yes, head portrait address information is obtained from the local cache; if not, calling the head portrait management server 103 to acquire head portrait address information from an external database, and storing the head portrait address information into a local cache; corresponding message information is generated according to the header address information and is sent to the service application 102, the service application 102 analyzes the message information to obtain the header address information and obtains corresponding user headers from the object storage server according to the header address information, and the service application 102 displays the user headers. The business application 102 sends the user head portrait to the object storage server for storage, and the object storage server feeds back head portrait address information; the business application 102 sends the avatar address information to the avatar management server 103, which stores the avatar address information to the redis database 104 and the mysql database 105. By adopting the method of inquiring in the local cache, timeliness can be ensured, resource expenditure can be reduced, response time of the user head portrait during each service display can be prolonged, and pressure of the database can be reduced to a certain extent. Even if the head portrait address information does not exist in the local cache, the relevant head portrait address information can be acquired from an external database and backfilled into the local cache so as to facilitate subsequent head portrait inquiry.
Embodiments of the present application will be described in detail below with reference to the accompanying drawings.
Fig. 2 is a flow chart of an avatar information processing method provided by the application, and the method is applied to a server. As shown in fig. 2, the method includes:
step 201, receiving an avatar query request sent by a service application, analyzing the avatar query request, and obtaining a user avatar identifier to be queried.
In this embodiment, when using the service application, the user may click to view information including the user avatar or view the user avatar in the service application, thereby triggering an avatar query request. The service application background server receives the head portrait inquiry request sent by the front-end service application, analyzes the head portrait inquiry request, and obtains the user head portrait identification to be inquired, wherein the user head portrait identification can be the user head portrait id.
Step 202, determining whether head portrait address information corresponding to a user head portrait identifier exists in a local cache; if yes, go to step 203a; if not, step 203b is performed.
In this embodiment, in order to quickly respond to a request, first, header address information is searched from a local cache, whether the local cache (local cache) stores header address information corresponding to a user header identifier is determined, specifically, a mapping relationship between the stored user header identifier and the header address information is preset, the user header identifier is matched with the stored user header identifier in the mapping relationship, and whether the local cache stores the header address information corresponding to the user header identifier is determined according to an identifier matching result.
Step 203a, obtaining the header address information from the local cache.
In this embodiment, if the header address information corresponding to the header identifier of the user exists in the local cache, which indicates that the user may be an active user, the relevant information of the active user is generally stored in the local cache, and then the header address information is obtained from the local cache.
Step 203b, calling the head portrait management server to obtain head portrait address information from an external database, and storing the head portrait address information in a local cache.
In this embodiment, if the local cache does not have the header address information corresponding to the header identifier of the user, which indicates that the user may be an inactive user, the header address information may be acquired from the external database, the header management server may be invoked to acquire the header address information from the external database, and the acquired header address information may be backfilled into the local cache.
Step 204, generating corresponding message information according to the head portrait address information, and sending the message information to a service application, so that the service application can analyze the message information to obtain the head portrait address information, obtain corresponding user head portraits from an object storage server according to the head portrait address information, and display the user head portraits; the head portrait address information in the external database is that the business application sends the head portrait of the user to the object storage server for storage so that the object storage server feeds back the head portrait address information, and the business application sends the head portrait address information to the head portrait management server which is stored in the external database by the head portrait management server.
In this embodiment, corresponding message information is further generated according to the header address information, the corresponding message information is sent to a front-end service application, the service application analyzes the message information to obtain the header address information, the service application is in communication connection with an object storage server, the service application sends the header address information to the object storage server, the object storage server feeds back a corresponding user header according to the header address information, the service application obtains the corresponding user header, and the service application displays the user header.
The service application sends the user head portrait to the object storage server, the object storage server stores the user head portrait, head portrait address information is fed back to the service application, the head portrait address information is a URL, and the URL is a uniform resource locator. The service application transmits the header address information to the header management server, and the header management server stores the header address information in an external database.
The method comprises the steps of receiving a head portrait inquiry request sent by a service application, analyzing the head portrait inquiry request, obtaining a user head portrait identifier to be inquired, determining whether the head portrait identifier of the user corresponds to head portrait address information in a local cache, and obtaining the corresponding head portrait address information from the local cache if the head portrait identifier of the user exists; if the user head portrait is not available, head portrait address information is obtained from an external database, the head portrait address information is stored in a local cache, message information is further generated according to the head portrait address information and is sent to service application, the service application analyzes the message information to obtain the head portrait address information, the service application obtains corresponding user head portraits from an object storage server according to the head portrait address information and displays the corresponding user head portraits, and the method of inquiring in the local cache is adopted, so that timeliness can be ensured, resource expenditure can be reduced, response time of the user head portraits in displaying each service can be prolonged, and pressure of the database can be reduced to a certain extent. Even if the head portrait address information does not exist in the local cache, the relevant head portrait address information can be acquired from an external database and backfilled into the local cache so as to facilitate subsequent head portrait inquiry.
Fig. 3 is a flow chart of another method for processing head portrait information provided by the present application, where the method is applied to a server, as shown in fig. 3, and the method includes:
step 301, receiving an avatar query request sent by a service application, analyzing the avatar query request, and obtaining a user avatar identifier to be queried.
In this embodiment, when using the service application, the user may click to view information including the user avatar or view the user avatar in the service application, thereby triggering an avatar query request. The service application background server receives the head portrait inquiry request sent by the front-end service application, analyzes the head portrait inquiry request, and obtains the user head portrait identification to be inquired, wherein the user head portrait identification can be the user head portrait id.
Step 302, determining whether the local cache contains the head portrait address information corresponding to the user head portrait identifier; if yes, go to step 302a; if not, step 302b is performed.
In this embodiment, in order to quickly respond to a request, first, header address information is searched from a local cache, whether the local cache (local cache) stores header address information corresponding to a user header identifier is determined, specifically, a mapping relationship between the stored user header identifier and the header address information is preset, the user header identifier is matched with the stored user header identifier in the mapping relationship, and whether the local cache stores the header address information corresponding to the user header identifier is determined according to an identifier matching result.
In one possible implementation, determining whether there is avatar address information in the local cache corresponding to the user avatar identifier includes:
acquiring a mapping relation between a head portrait identifier and head portrait address information pre-stored in a local cache; matching the user head portrait identification with the mapping relation; if the user head portrait identification is matched with the head portrait identification prestored in the mapping relation, determining that head portrait address information corresponding to the user head portrait identification exists in the local cache; if the user head portrait identification is not matched with the pre-stored head portrait identification in the mapping relation, determining that head portrait address information corresponding to the user head portrait identification does not exist in the local cache.
In this embodiment, a mapping relationship between a pre-stored head portrait identifier and head portrait address information in a local cache is obtained, the head portrait identifier of a user is matched with the mapping relationship, whether the head portrait address information corresponding to the head portrait identifier of the user exists in the local cache is determined according to a matching result, specifically, if the head portrait identifier of the user is matched with the pre-stored head portrait identifier in the mapping relationship, the head portrait address information corresponding to the head portrait identifier of the user exists in the local cache, and the head portrait identifier and the head portrait address information of the user existing in the local cache indicate that the user is an active user; in contrast, if the user is an inactive user, the corresponding avatar identifier and the avatar address information are not in the local cache, the number of users is large, and the general users in the cache store relevant information of the more active users, but the relevant information of the active users or the inactive users is stored in an external database, so that the purpose of the method is to quickly respond to the request of the service program, and the data of the active users are still in the cache, and the data of the inactive users are eliminated from the cache.
Step 303a, obtaining the header address information from the local cache.
In this embodiment, if the header address information corresponding to the header identifier of the user exists in the local cache, which indicates that the user may be an active user, the relevant information of the active user is generally stored in the local cache, and then the header address information is obtained from the local cache.
Step 303b, calling an avatar management server to determine whether the avatar address information corresponding to the user avatar identifier exists in the redis database; if yes, go to step 303b1; if not, step 303b2 is performed.
In this embodiment, if there is no avatar address information corresponding to the user avatar identifier in the local cache, the avatar address information is acquired from the external database, and the avatar management service is first invoked to determine whether there is the avatar address information corresponding to the user avatar identifier in the redis database, where the redis database is an efficient cache database, and can respond quickly, and if there is a redis database, the avatar address information in the redis database is acquired; and if the redis database is not available, storing the avatar address information of each user into the mysql database from the avatar address information in the mysql database, wherein the mysql database is a persistent database.
Step 303b1, call the avatar management server to obtain the avatar address information from the redis database.
In this embodiment, if it is determined that the redis database has the avatar address information corresponding to the user avatar identifier, the avatar management server is invoked to acquire the avatar address information from the redis database, and further store the avatar address information in the local cache.
Step 303b2, call the avatar management server to obtain the avatar address information from the mysql database, and write the avatar address information into the redis database.
In this embodiment, if it is determined that the redis database does not have the header address information corresponding to the user header identifier, the header management server is invoked to acquire the header address information from the mysql database, further store the header address information into the local cache, and generate corresponding message information according to the header address information.
Step 304, generating corresponding message information according to the head portrait address information, and sending the message information to a service application, so that the service application can analyze the message information to obtain the head portrait address information, obtain corresponding user head portraits from an object storage server according to the head portrait address information, and display the user head portraits; the head portrait address information in the external database is that the business application sends the head portrait of the user to the object storage server for storage so that the object storage server feeds back the head portrait address information, and the business application sends the head portrait address information to the head portrait management server which is stored in the external database by the head portrait management server.
In this embodiment, corresponding message information is further generated according to the header address information, the corresponding message information is sent to a front-end service application, the service application analyzes the message information to obtain the header address information, the service application is in communication connection with an object storage server, the service application sends the header address information to the object storage server, the object storage server feeds back a corresponding user header according to the header address information, the service application obtains the corresponding user header, and the service application displays the user header.
The service application sends the user head portrait to the object storage server, the object storage server stores the user head portrait, head portrait address information is fed back to the service application, the head portrait address information is a URL, and the URL is a uniform resource locator. The service application transmits the header address information to the header management server, and the header management server stores the header address information in an external database.
The application adopts the mode of inquiring in the local cache, can ensure timeliness and reduce the cost of resources, improves the response time of the user head portrait when each service is displayed, and reduces the pressure of the database to a certain extent. Even if the local cache does not contain the head portrait address information, the relevant head portrait address information can be acquired from an efficient cache database such as a rediss database or a persistent database such as a mysql database and backfilled into the local cache so as to facilitate subsequent head portrait inquiry.
Fig. 4 is a flow chart of another method for processing head portrait information provided by the present application, where the method is applied to a server, as shown in fig. 4, and the method includes:
step 401, receiving an avatar changing request sent by a service application, analyzing the avatar changing request, and obtaining the avatar address information to be changed and the changing user identifier, where the avatar address information is the avatar address information of the user to be changed sent by the service application to the object storage server for storing feedback by the object storage server.
In this embodiment, when the user uses the service application, the user may change his own user avatar in the service application, thereby triggering an avatar change request. The head portrait management server receives a head portrait change request sent by the service application, analyzes the head portrait change request, and acquires head portrait address information to be changed and a change user identifier.
The business application sends the user head portrait to be changed to the object storage server, the object storage server stores the user head portrait, the head portrait address information is fed back, and the business application receives the head portrait address information fed back by the object storage server.
And step 402, updating the head portrait address information corresponding to the changed user identification in the external database by using the head portrait address information.
In this embodiment, the header address information corresponding to the changed user identifier in the external database is updated with the header address information, and the external database includes a redis database and a mysql database.
In one possible implementation, updating the header address information corresponding to the change user identifier in the external database with the header address information includes:
and updating the head portrait address information corresponding to the changed user identifier in the redis database by using the head portrait address information, and updating the head portrait address information corresponding to the changed user identifier in the mysql database by using the head portrait address information.
In this embodiment, the avatar management server sends the change user identifier and the avatar address information to the redis database, and the redis database updates the stored avatar address information corresponding to the change user identifier by using the avatar address information to update the data in the redis database. And the head portrait management server sends the changed user identification and the head portrait address information to a mysql database, and the stored head portrait address information corresponding to the changed user identification is updated by adopting the head portrait address information in the mysql database so as to update the data in the mysql database.
Optionally, the method for processing head portrait information further includes:
and distributing the head portrait address information and the corresponding changed user identification to a server corresponding to the application associated with the business application by adopting the application program coordination service, so that the corresponding server can update the head portrait address information corresponding to the matched user identification by using the head portrait address information after determining that the user identification matched with the changed user identification exists in the local cache.
In this embodiment, the application coordination service is a ZooKeeper, which is a distributed, open source distributed application coordination service, and uses the application coordination service to distribute the header address information and the corresponding changed user identifier to the server corresponding to the application associated with the service application, where the server corresponding to the associated application determines whether there is a user identifier matching the changed user identifier in the local cache, and if it is determined that there is a user identifier matching the changed user identifier in the local cache, updates the header address information corresponding to the matched user identifier with the header address information, so as to update the header address information, and keep the data synchronization.
The application adopts the head portrait management server to effectively relieve the pressure of the business server, and adopts the application program coordination service to distribute the information so as to ensure the consistency of the data.
Fig. 5 is a flow chart of another method for processing head portrait information provided by the present application, where the method is applied to a server, as shown in fig. 5:
step 501, receiving a new request of the head portrait sent by the service application, analyzing the new request of the head portrait, and obtaining the new user identification and the address information of the new head portrait.
In this embodiment, the avatar management server receives the avatar addition request sent by the service application, analyzes the avatar addition request, obtains the newly added user identifier and the newly added avatar address information, and stores the avatar address information in an external database in order to ensure that the avatar address information is retrieved later.
Step 501, the new user identifier and the new avatar address information are sent to an external database, so that the external database can store the new user identifier and the new avatar address information in an associated manner.
In this embodiment, the added user identifier and the added avatar address information are sent to an external database, specifically, the avatar management server sends the added user identifier and the added avatar address information to a redis database, and the redis database stores the added user identifier and the added avatar address information in an associated manner; and the avatar management server sends the newly-added user identification and the newly-added avatar address information to a mysql database, and the mysql database carries out association storage on the newly-added user identification and the newly-added avatar address information.
According to the application, the head portrait management server is adopted to effectively relieve the pressure of the service server, and information is stored in the redis database and the mysql database, so that the follow-up service server can acquire related information conveniently.
Fig. 6 is a schematic structural diagram of an apparatus for processing head portrait information according to the present application, as shown in fig. 6, the apparatus 600 for processing head portrait information according to the present embodiment includes a first transceiver 601, a first obtaining unit 602, a determining unit 603, and a first processing unit 604.
Optionally, the first transceiver unit 601 is configured to receive an avatar query request sent by a service application. The first obtaining unit 602 is configured to parse the avatar query request, and obtain a user avatar identifier to be queried. The determining unit 603 is configured to determine whether there is header address information corresponding to the user header identifier in the local cache. The first processing unit 604 is configured to obtain the header address information from the local cache if yes. The first processing unit 604 is further configured to invoke the avatar management server to obtain the avatar address information from the external database, and store the avatar address information in the local cache if not. The first processing unit 604 is further configured to generate corresponding message information according to the header address information. The first transceiver 601 is further configured to send the message information to a service application, so that the service application parses the message information to obtain header address information, obtains a corresponding user header from the object storage server according to the header address information, and displays the user header; the head portrait address information in the external database is that the business application sends the head portrait of the user to the object storage server for storage so that the object storage server feeds back the head portrait address information, and the business application sends the head portrait address information to the head portrait management server which is stored in the external database by the head portrait management server.
Optionally, the first processing unit 604 is further configured to call a avatar management server to determine whether there is avatar address information corresponding to the user avatar identifier in the redis database; if yes, calling an avatar management server to acquire the avatar address information from the redis database; if not, calling an avatar management server to acquire the avatar address information from the mysql database, and writing the avatar address information into the redis database.
Optionally, the first processing unit 604 is further configured to obtain a mapping relationship between the avatar identifier and the avatar address information pre-stored in the local cache; matching the user head portrait identification with the mapping relation;
if the user head portrait identification is matched with the head portrait identification prestored in the mapping relation, determining that head portrait address information corresponding to the user head portrait identification exists in the local cache; if the user head portrait identification is not matched with the pre-stored head portrait identification in the mapping relation, determining that head portrait address information corresponding to the user head portrait identification does not exist in the local cache.
Fig. 7 is a schematic structural diagram of another head portrait information processing device according to the present application, and as shown in fig. 7, another head portrait information processing device 700 according to this embodiment includes a second transceiver unit 701, a second obtaining unit 702, and a second processing unit 703.
The second transceiver unit 701 is configured to receive an avatar change request sent by a service application. The second obtaining unit 702 is configured to parse the header change request, obtain header address information to be changed and a change user identifier, where the header address information is the header address information of the user to be changed sent by the service application to the object storage server for storing the user header to be changed. The second processing unit 703 is configured to update the header address information corresponding to the changed user identifier in the external database with the header address information.
Optionally, the second processing unit 703 is further configured to update the avatar address information corresponding to the change user identifier in the redis database with the avatar address information, and update the avatar address information corresponding to the change user identifier in the mysql database with the avatar address information.
Optionally, the second processing unit 703 is further configured to distribute the avatar address information and the corresponding changed user identifier to a server corresponding to an application associated with the service application by using an application coordination service, so that after determining that the user identifier matching the changed user identifier exists in the local cache, the corresponding server updates the avatar address information corresponding to the matched user identifier with the avatar address information.
Optionally, the second transceiver unit 701 is further configured to receive a header adding request sent by the service application. The second obtaining unit 702 is further configured to parse the header adding request, and obtain the added user identifier and the added header address information. The second transceiver unit 701 is further configured to send the new user identifier and the new avatar address information to an external database, so that the external database stores the new user identifier and the new avatar address information in association.
It should be noted that, it should be understood that the division of the modules of the above apparatus is merely a division of a logic function, and may be fully or partially integrated into a physical entity or may be physically separated. And these modules may all be implemented in software in the form of calls by the processing element; or can be realized in hardware; the method can also be realized in a form of calling software by a processing element, and the method can be realized in a form of hardware by a part of modules. The modules may be processing elements that are individually set up, may be implemented as integrated in a chip of the above-described apparatus, or may be stored in a memory of the above-described apparatus in the form of program codes, and the functions of the above-described modules may be called and executed by a processing element of the above-described apparatus. In addition, all or part of the modules can be integrated together or can be independently implemented. The processing element here may be an integrated circuit with signal processing capabilities. In implementation, each step of the above method or each module above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in a software form.
Fig. 8 is a schematic structural diagram of a server according to an embodiment of the present application. As shown in fig. 8, the server may include: a transceiver 801, a processor 802, and a memory 803.
Processor 802 executes the computer-executable instructions stored in the memory, causing processor 802 to perform the aspects of the embodiments described above. The processor 802 may be a general-purpose processor including a central processing unit CPU, a network processor (network processor, NP), etc.; but may also be a digital signal processor DSP, an application specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
The memory 803 is coupled to the processor 802 via a system bus and communicates with each other, and the memory 803 is adapted to store computer program instructions.
The transceiver 801 may be used to obtain tasks to be run and configuration information for the tasks to be run.
The system bus may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The system bus may be classified into an address bus, a data bus, a control bus, and the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus. The transceiver is used to enable communication between the database access device and other computers (e.g., clients, read-write libraries, and read-only libraries). The memory may include random access memory (random access memory, RAM) and may also include non-volatile memory (non-volatile memory).
The embodiment of the application also provides a chip for running the instruction, which is used for executing the technical scheme of the head portrait information processing method in the embodiment.
The embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores computer instructions, and when the computer instructions run on a computer, the computer is caused to execute the technical scheme of the head portrait information processing method of the embodiment.
The embodiment of the application also provides a computer program product, which comprises a computer program stored in a computer readable storage medium, wherein at least one processor can read the computer program from the computer readable storage medium, and the technical scheme of the head portrait information processing method in the embodiment can be realized when the at least one processor executes the computer program.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, e.g., the division of modules is merely a logical function division, and there may be additional divisions of actual implementation, e.g., multiple modules may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules illustrated as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.
In addition, each functional module in the embodiments of the present application may be integrated in one processing unit, or each module may exist alone physically, or two or more modules may be integrated in one unit. The units formed by the modules can be realized in a form of hardware or a form of hardware and software functional units.
The integrated modules, which are implemented in the form of software functional modules, may be stored in a computer readable storage medium. The software functional modules described above are stored in a storage medium and include instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or processor to perform some of the steps of the methods of the various embodiments of the application.
It should be understood that the above processor may be a central processing unit (Central Processing Unit, abbreviated as CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, abbreviated as DSP), application specific integrated circuits (Application Specific Integrated Circuit, abbreviated as ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile memory NVM, such as at least one magnetic disk memory, and may also be a U-disk, a removable hard disk, a read-only memory, a magnetic disk or optical disk, etc.
The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (Peripheral Component Interconnect, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the buses in the drawings of the present application are not limited to only one bus or to one type of bus.
The storage medium may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short). Of course, the processor and the storage medium may reside as discrete components in an electronic control unit or master control device.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application.

Claims (12)

1. A head portrait information processing method, characterized in that the method comprises:
receiving an avatar query request sent by a service application, analyzing the avatar query request, and obtaining a user avatar identifier to be queried;
determining whether head portrait address information corresponding to the user head portrait identification exists in a local cache;
if yes, acquiring the head portrait address information from the local cache;
if not, calling an avatar management server to acquire the avatar address information from an external database, and storing the avatar address information into the local cache;
generating corresponding message information according to the head portrait address information, and sending the message information to the service application, so that the service application can analyze the message information to obtain head portrait address information, obtain corresponding user head portraits from an object storage server according to the head portrait address information, and display the user head portraits;
the head portrait address information in the external database is that a business application sends a user head portrait to the object storage server for storage so that the object storage server feeds back the head portrait address information, and the business application sends the head portrait address information to the head portrait management server and the head portrait management server stores the head portrait address information to the external database.
2. The method of claim 1, wherein the external database comprises: a redis database and a mysql database;
the calling the head portrait management server to acquire the head portrait address information from an external database comprises the following steps:
calling a head portrait management server to determine whether head portrait address information corresponding to the user head portrait identification exists in a redis database;
if yes, calling the head portrait management server to acquire the head portrait address information from a redis database;
if not, calling an avatar management server to acquire the avatar address information from the mysql database, and writing the avatar address information into the redis database.
3. The method of claim 1, wherein determining whether the avatar address information corresponding to the user avatar identification exists in the local cache comprises:
acquiring a mapping relation between a head portrait identifier and head portrait address information pre-stored in the local cache;
matching the user head portrait identification with the mapping relation;
if the user head portrait identification is matched with the head portrait identification prestored in the mapping relation, determining that head portrait address information corresponding to the user head portrait identification exists in the local cache;
And if the user head portrait identification is not matched with the head portrait identification prestored in the mapping relation, determining that head portrait address information corresponding to the user head portrait identification does not exist in the local cache.
4. A head portrait information processing method, characterized in that the method comprises:
receiving an avatar changing request sent by a service application, analyzing the avatar changing request, and obtaining avatar address information to be changed and a changing user identifier, wherein the avatar address information is obtained by the service application, and the service application sends the user avatar to be changed to an object storage server to store the avatar address information fed back by the object storage server;
and updating the head portrait address information corresponding to the change user identifier in an external database by using the head portrait address information.
5. The method of claim 4, wherein the external database comprises: a redis database and a mysql database;
the updating the header address information corresponding to the changed user identifier in the external database by using the header address information comprises the following steps:
and updating the head portrait address information corresponding to the change user identifier in the redis database by using the head portrait address information, and updating the head portrait address information corresponding to the change user identifier in the mysql database by using the head portrait address information.
6. The method as recited in claim 4, further comprising:
and distributing the head portrait address information and the corresponding changed user identification to a server corresponding to the application associated with the business application by adopting an application program coordination service, so that the corresponding server updates the head portrait address information corresponding to the matched user identification by using the head portrait address information after determining that the user identification matched with the changed user identification exists in the local cache.
7. The method as recited in claim 6, further comprising:
receiving a head portrait newly-added request sent by a service application, analyzing the head portrait newly-added request, and acquiring a newly-added user identifier and newly-added head portrait address information;
and sending the new user identification and the new avatar address information to the external database so that the external database can store the new user identification and the new avatar address information in an associated mode.
8. An avatar information processing apparatus, characterized by comprising:
the first receiving and transmitting unit is used for receiving an avatar query request sent by the service application;
the first acquisition unit is used for analyzing the head portrait inquiry request and acquiring a user head portrait identifier to be inquired;
The determining unit is used for determining whether the head portrait address information corresponding to the head portrait identifier of the user exists in the local cache;
the first processing unit is used for acquiring the head portrait address information from the local cache if yes;
the first processing unit is also used for calling the head portrait management server to acquire the head portrait address information from an external database and storing the head portrait address information into the local cache if not;
the first processing unit is also used for generating corresponding message information according to the head portrait address information;
the first receiving and transmitting unit is further used for transmitting the message information to the service application, so that the service application can analyze the message information to obtain head portrait address information, obtain corresponding user head portraits from an object storage server according to the head portrait address information, and display the user head portraits;
the head portrait address information in the external database is that a business application sends a user head portrait to the object storage server for storage so that the object storage server feeds back the head portrait address information, and the business application sends the head portrait address information to the head portrait management server and the head portrait management server stores the head portrait address information to the external database.
9. An avatar information processing apparatus, characterized by comprising:
the second receiving and transmitting unit is used for receiving the head portrait change request sent by the service application;
the second acquisition unit is used for analyzing the head portrait change request, acquiring head portrait address information to be changed and a change user identifier, wherein the head portrait address information is that the business application sends the head portrait of the user to be changed to the object storage server to store the head portrait address information fed back by the object storage server;
and the second processing unit is used for updating the head portrait address information corresponding to the change user identification in an external database by using the head portrait address information.
10. A server, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the method of any one of claims 1 to 7.
11. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are adapted to carry out the method of any one of claims 1 to 7.
12. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1 to 7.
CN202311266049.7A 2023-09-27 2023-09-27 Head portrait information processing method, device, server and storage medium Pending CN117176810A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311266049.7A CN117176810A (en) 2023-09-27 2023-09-27 Head portrait information processing method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311266049.7A CN117176810A (en) 2023-09-27 2023-09-27 Head portrait information processing method, device, server and storage medium

Publications (1)

Publication Number Publication Date
CN117176810A true CN117176810A (en) 2023-12-05

Family

ID=88933726

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311266049.7A Pending CN117176810A (en) 2023-09-27 2023-09-27 Head portrait information processing method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN117176810A (en)

Similar Documents

Publication Publication Date Title
WO2019100853A1 (en) Page query method, device, and electronic apparatus
CN111475519B (en) Data caching method and device
CN105488125A (en) Page access method and apparatus
CN111190970A (en) Data mapping method, device and computer readable storage medium
CN111008892A (en) Business limit adjusting method and device and computer readable storage medium
CN111047434B (en) Operation record generation method and device, computer equipment and storage medium
CN111737564A (en) Information query method, device, equipment and medium
CN109656592B (en) Card management method, device, terminal and computer readable storage medium
CN111464487A (en) Access control method, device and system
CN111984712B (en) Information processing method, device and storage medium
CN115729912A (en) Database access system, database access method, computer device, and storage medium
CN110442636B (en) Data reading and writing method and device and data reading and writing equipment
CN110889073B (en) Page request response method, server and computer storage medium
CN112434037A (en) Data processing method, processing device, data processing apparatus, and storage medium
CN106569408B (en) Processing system, method and device for personalized information of intelligent equipment
CN117176810A (en) Head portrait information processing method, device, server and storage medium
CN111767481A (en) Access processing method, device, equipment and storage medium
CN113254470B (en) Data modification method, device, computer equipment and storage medium
CN111652580B (en) Method and device for processing data of nodes
CN111506644B (en) Application data processing method and device and electronic equipment
CN113312412A (en) Statistical data acquisition method and device, electronic equipment and storage medium
CN111008220A (en) Dynamic identification method and device of data source, storage medium and electronic device
CN112052267A (en) Data query method, equipment, server and storage medium
CN110858201A (en) Data processing method and system, processor and storage medium
CN114416782A (en) Data query method and device

Legal Events

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