Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Regarding the data storage of the evaluation area of the network information, the most widely used method is to store the comment information through a relational database at present, and the comment information is usually stored according to a time sequence, and when the storage mode is displayed on a client, complex query logic is needed for tree splicing, and the query pressure of data storage equipment is overlarge.
Another storage mode of comment information is a tree-shaped storage mode, wherein comments are divided into main comments and non-main comments, the main comments are comments on a content subject, for example, in an evaluation area of a certain news content, the comments on the news content are directly main comments, the non-main comments refer to replies to the comments (including the main comments and the non-main comments), the storage mode generally adopts a non-relational database, and the comments are stored in the non-relational database in a displayed tree structure. The comment content does not need to record the data of the upper node, and only needs to store the concerned content in the comment, so that the relation between the upper node and the lower node is not required to be processed when the structure is queried, and the query speed is much faster than that of a scheme using a relational database.
However, for the background manager, because the storage of the data is loose, the content of the single data is not comprehensive, the single data needs to be judged according to the context of the content, the single data cannot be directly used by the manager, the data needs to be processed and complemented, then the data display structure convenient for the background manager to manage is used for typesetting the original data, and the stored data cannot be directly used.
According to the invention, two sets of data storage are established according to the characteristics of two data storage modes, and the synchronization is carried out through the message middleware, so that the problem of efficiency of repeated inquiry of the database when the client side displays is solved, and the management of comment data by an administrator is facilitated.
FIG. 1 shows a schematic diagram of a data processing system 100 according to one embodiment of the invention. As shown in fig. 1, the data processing system 100 includes a server 110, a client 120, and a management terminal 130, and the server 110 is communicatively connected to the client 120 and the management terminal 130, respectively. It should be noted that the data processing system shown in fig. 1 is merely exemplary, and in practice, there may be a plurality of clients and management terminals, and the present invention is not limited to the clients and management terminals included in the data processing system.
The server 110 is a device having communication, calculation, and storage functions, and may be implemented as a server, for example, an application server, a Web server, or the like, but is not limited thereto. The server 110 may be implemented as one server, or may be implemented as a cluster or a distributed system formed by a plurality of servers; in the case of multiple servers, the multiple servers may be deployed in the same geographic location, or may be distributed in multiple geographic locations, and the number of servers included in the server 110 and the deployment location of each server are not limited in the present invention.
The client 120 may be, for example, a personal computer such as a desktop computer or a notebook computer, a mobile terminal such as a mobile phone, a tablet computer, a multimedia player, an intelligent wearable device, or a device such as an intelligent television, but is not limited thereto.
The management terminal 130 is typically a personal configured computer such as a desktop computer, a notebook computer, or the like.
According to one embodiment of the present invention, a user may comment on data information such as news, video, etc. on a network through the client 120, for example, leave a message or comment on a message board or comment area of the information such as news, video, etc., where the data information of the message or comment is sent to the server 110, the server 110 includes two data storage devices (not shown in fig. 1), a first data storage device and a second data storage device, and after the server 110 acquires the message or comment information, the server stores the data in the first data storage device and synchronizes to the second data storage device. When the user browses through the client 120, the comment data is obtained from the second data storage device, and when the management terminal filters the sensitive information of the comment information of the user, the administrator obtains the comment data from the first data storage device.
The server 110 in FIG. 1 may be implemented by a computing device, and FIG. 2 illustrates a block diagram of a computing device 200 in accordance with one embodiment of the invention. It should be noted that the computing device 200 shown in fig. 2 is only an example, and in practice, the computing device used to implement the data processing method 300/400 of the present invention may be any type of device, and the hardware configuration of the computing device may be the same as the computing device 200 shown in fig. 2 or may be different from the computing device 200 shown in fig. 2. In practice, a computing device implementing the data processing method 300/400 of the present invention may add or delete hardware components of the computing device 200 shown in fig. 2, and the present invention is not limited to a specific hardware configuration of the computing device.
As shown in FIG. 2, in a basic configuration 202, computing device 200 typically includes a system memory 206 and one or more processors 204. A memory bus 208 may be used for communication between the processor 204 and the system memory 206.
Depending on the desired configuration, the processor 204 may be any type of processing including, but not limited to: a microprocessor (μp), a microcontroller (μc), a digital information processor (DSP), or any combination thereof. Processor 204 may include one or more levels of cache, such as a first level cache 210 and a second level cache 212, a processor core 214, and registers 216. The example processor core 214 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 218 may be used with the processor 204, or in some implementations, the memory controller 218 may be an internal part of the processor 204.
Depending on the desired configuration, system memory 206 may be any type of memory including, but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. Physical memory in a computing device is often referred to as volatile memory, RAM, and data in disk needs to be loaded into physical memory in order to be read by processor 204. The system memory 206 may include an operating system 220, one or more applications 222, and program data 224. In some implementations, the application 222 may be arranged to execute instructions on an operating system by the one or more processors 204 using the program data 224. The operating system 220 may be, for example, linux, windows or the like, which includes program instructions for handling basic system services and performing hardware-dependent tasks. The application 222 includes program instructions for implementing various user desired functions, and the application 222 may be, for example, a browser, instant messaging software, a software development tool (e.g., integrated development environment IDE, compiler, etc.), or the like, but is not limited thereto. When an application 222 is installed into computing device 200, a driver module may be added to operating system 220.
When the computing device 200 starts up running, the processor 204 reads the program instructions of the operating system 220 from the memory 206 and executes them. Applications 222 run on top of operating system 220, utilizing interfaces provided by operating system 220 and underlying hardware, to implement various user-desired functions. When the user launches the application 222, the application 222 is loaded into the memory 206, and the processor 204 reads and executes the program instructions of the application 222 from the memory 206.
Computing device 200 also includes a storage device 232, where storage device 232 includes removable storage 236 and non-removable storage 238, where removable storage 236 and non-removable storage 238 are each connected to storage interface bus 234.
Computing device 200 may also include an interface bus 240 that facilitates communication from various interface devices (e.g., output devices 242, peripheral interfaces 244, and communication devices 246) to basic configuration 202 via bus/interface controller 230. The example output device 242 includes a graphics processing unit 248 and an audio processing unit 250. They may be configured to facilitate communication with various external devices, such as a display or speakers, via one or more a/V ports 252. The example peripheral interface 244 may include a serial interface controller 254 and a parallel interface controller 256, which may be configured to facilitate communication via one or more I/O ports 258 and external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.). The example communication device 246 may include a network controller 260 that may be arranged to facilitate communication with one or more other computing devices 262 over a network communication link via one or more communication ports 264.
The network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media in a modulated data signal, such as a carrier wave or other transport mechanism. A "modulated data signal" may be a signal that has one or more of its data set or changed in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or special purpose network, and wireless media such as acoustic, radio Frequency (RF), microwave, infrared (IR) or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
In the computing device 200 according to the invention, the application 222 comprises instructions for performing the data processing method 300/400 of the invention, which instructions may instruct the processor 204 to perform the data processing method 300/400 of the invention.
Fig. 3 illustrates a flow chart of a data processing method 300 according to one embodiment of the invention, the method 300 being adapted to be performed in a server (e.g., implemented by the computing device of fig. 2), the server being communicatively coupled to a client, a user browsing subject content such as news, video, etc. in a website via the client, and comment information or messages of the user in the subject content, which comment information may eventually be stored in the server via the client, the server comprising a first data storage device, a second data storage device, and message middleware, the information in the first data storage device being stored in the second data storage device via the message middleware.
According to the embodiment of the invention, the first data storage device may be implemented by a relational database, which may be any relational database such as Oracle, SQLServer, DB2, mysql, but is not limited thereto. The second data storage device may be implemented by a non-relational database, and may be any of CouchDB, mongoDb, sequoiaDB, etc., but is not limited thereto. The invention is not limited to the specific implementation of the data storage mode, and other data storage modes with similar functions are also within the protection scope of the invention.
As shown in fig. 3, the method 300 begins at step S310. In step S310, comment information posted by a user is acquired from a client, which is referred to as first comment information. The first comment information comprises a main content identifier, a main comment identifier, a reply object identifier, a comment object, comment users, comment content and comment time, so that the server side can correspondingly store the currently received comment information according to the information and update the currently received comment information to a website, and the user can browse the comment information conveniently.
According to an embodiment of the present invention, the body content identifier is the unique identifier of the top level body content, such as the unique identifier 010101 corresponding to the video of the focus interview today, for distinguishing other body contents on the same website, then 010101 is the body content identifier of the focus interview today, and the unique identifier of the body content is generally generated when the body content is transmitted to the website.
Each subject content corresponds to an evaluation area, wherein the evaluation area comprises direct comments (also called primary comments) of the subject content, comments (primary comments) of the subject content, secondary comments, tertiary comments and so on, and comments after the primary comments are collectively called non-primary comments. Each comment (including both a main comment and a non-main comment) in the comment area corresponds to a main key ID to uniquely identify the comment. The main comment identification contained in the comment information refers to the main key ID of the main comment corresponding to the currently acquired comment information. If the main comment carried by the currently received first comment information is marked with 0, the comment information is the main comment.
The reply object identifier is a main key ID of the previous-level comment information of the currently received first comment information, and if the main comment identifier carried by the currently received comment information is '0', the comment information is a main comment.
The comment object is a user network name of the previous comment of the comment information, and when the first comment information is the main comment, the comment object carried by the first comment information is empty.
The comment users are network names of users who post current comment information, comment content is related content posted by the users, and comment time is time when the users post comments.
After receiving the first comment information, the flow advances to step S320, where the received first comment information is stored in the first data storage device.
According to one embodiment of the invention, there is a subject content whose subject content identifier is 030303 on the a website, which currently includes three comments including a main comment of the user ' Zhang san ', a comment of the user ' Lisi four ' to the Zhang san ', and a comment of the user ' Wang Wu ' to the Zhang san main comment. In this embodiment, the first storage device is implemented in a relational database, where the relational database is generally stored in a list manner according to time, and according to current comment information, data in the first data storage device is stored as shown in table 1.
TABLE 1
According to one embodiment of the present invention, the first comment information received in step S310 has a main content of "030303", a main comment identification of "1", a reply object identification of "2", a comment object of "litu", a comment user of "Xiaoming", a comment content of "homonym you", and a comment time of "2020/1/1/12:03". In this step, a primary key ID is first generated for the first comment information currently received, a primary key ID "4" of the comment information is generated in a self-increasing manner by the primary key ID, and a new comment information record is generated according to the primary key ID and fields in the first comment information and is stored in the first storage device.
According to yet another embodiment of the present invention, in step S310, after receiving comment information of a comment information, the main content is "040404", the main comment identifier is "0", the reply object identifier is "0", the comment object is "", the comment user is "small white", the comment content is "daily diet today", the comment time is "2020/1/1/12:04", and the comment information of small white "after entering this step, the main key ID"5 "of the comment information is generated first, and an instruction corresponding to the addition record of the first data storage device implementation mode is generated according to the main key ID and the received first comment information, for example, an instruction corresponding to the addition record of the first data storage device implementation mode is generated if the first data storage device has an SQLserver implementation, and the newly generated comment record is stored in the first data storage device. Finally, the data in the first data storage device is updated as shown in table 2.
TABLE 2
In step S320, the method further includes returning the comment information processing result to the client.
In step S330, the first comment information is synchronized into the message middleware. The message middleware can shield the difference of characteristics among different storage devices, so that the coupling degree between the first storage device and the second storage device is reduced, the logic responsibility degree when a user issues comments is reduced, and the operation of the user is responded more quickly. Message middleware may use any of ActiveMQ, rabbitMQ, kafka, etc., as the present invention is not limited in this regard.
According to one embodiment of the present invention, the first comment message and the corresponding primary key ID are stored in a message middleware (such as a database, for example), which may also be understood as storing a comment record newly created in a first data storage device (a relational database) in the message middleware, so as to activate synchronization of the comment information by a second data storage device, and when synchronizing a message in the message middleware, an operation type is added, and when adding new comment information, the operation type may be identified by "a".
Step S340 is then entered to synchronize the comment information and the primary key ID in the message middleware into the second data storage device. When the middleware receives the message update, that is, when the first data storage device synchronizes to the middleware, the second storage device is activated to perform message synchronization according to the message in the message middleware, and according to the embodiment of the invention, the second data storage device is implemented in a non-relational database and is stored in a tree structure, so that comment information is added with a reply field in the data structure to store next-level comment information. In particular, any of CouchDB, mongoDb, sequoiaDB and the like may be used, but the present invention is not limited thereto.
Continuing with the above description of the embodiment, the data in the second data storage device is shown in FIG. 5 before the comments on Lifour by "Ming" and the comments on body content "040404" by "Ming" are updated.
Taking the comment of 'Xiaoming' on 'Liqu' as an example, in the step, firstly, obtaining operation type as adding comment information, then obtaining the comment information of the previous stage according to the reply object identification in the comment information, according to fig. 4, obtaining the main key ID of the comment information of the previous stage as 2, adding a 'reply' field in the comment information, and adding the comment of 'Xiaoming' on 'Liqu' to the 'reply' field.
According to an embodiment of the present invention, when the comment of "xiaobai" to the subject content "040404" is a main comment of the user to another subject content, a new data record is directly created, the comment information is recorded, and the data in the updated second data storage device is stored as shown in fig. 6.
The comment information posted by each user is stored according to the method 300, so that when the user opens the corresponding content, the user comment in the comment area can be quickly obtained from the non-relational database at the server side, and because the storage structure is directly stored in a tree structure, the tree structure is not needed to be spliced according to the node relation between the upper level and the lower level, the logic complexity of the query is greatly reduced, the query speed of the client is increased, and the user experience is improved.
FIG. 4 shows a flow chart of a data processing method 400 according to one embodiment of the invention; the method 400 is suitably performed in a server (e.g., implemented by a computing device in fig. 2) in communication with a management terminal through which an administrator may obtain user comment information from a first data storage device of the server, because the first data storage device is implemented by a relational database, the comment data being stored according to a chronological order, which is simpler for an administrator focusing on the latest posting information. And the administrator carries out operations such as corresponding modification or deletion on the corresponding comment information through filtering the sensitive information in the user comment.
As shown in fig. 4, the method 400 begins with step S410, in which updated comment information (i.e., second comment information) submitted by an administrator is obtained from a management terminal, where the second comment information includes a primary key ID, an operation identifier, and/or a modified field, and the modified field is one or more of a main content identifier, a main comment identifier, a reply object identifier, a comment object, a comment user, a comment content, and a comment time, and the operation identifier may be modified by "U" and deleted by "D". Taking the comment information in table 2 as an example, for example, if the administrator is to delete the comment record with the primary key of 4, the second comment information submitted by the management terminal includes the primary key ID "4", the operation identifier "D", and for the deletion operation, the modified field may not be included.
In step S420, the data in the first data storage device is updated according to the data in the second comment information. When the operation identifier in the acquired second comment information is U, acquiring corresponding comment information according to the main key ID, and modifying the response field in the comment information according to the field carried in the second comment information. If the operation identifier is "D", corresponding comment information is obtained according to the main key ID, and is set to be in a "delete" state or is directly deleted.
Step S430 is then entered to store the second comment information in the message middleware and synchronize to the second data storage device. And when the second comment information is written into the message middleware, triggering the second data storage device to acquire corresponding information from the message middleware for synchronization.
According to one embodiment of the present invention, the second comment information includes a main key ID "5", an operation identifier "U" and comment content "no daily diet today", and after the second data storage device acquires the synchronization message, the second data storage device searches the comment record according to the main key ID, and modifies the comment content therein to "no daily diet today", which is only an exemplary illustration.
It should be noted that, during the deletion operation, the comment record in response may be deleted directly or set to a deletion state when the data operation is performed as required, if the comment record is set to a "deletion" state, when the client acquires the comment content from the second data storage device, the comment content is only not displayed, but the comment of the next level of the comment is still normally displayed, when the comment record is deleted directly, the comment record and the comment record below the comment record are deleted directly in the second data storage device, and the client may not acquire the comment information and the comment record below the comment record deleted in specific practice.
Fig. 5 shows a schematic diagram of a data processing apparatus 500 according to an embodiment of the invention, the apparatus 500 being adapted to reside in a server, performing the method 300/400, the server being communicatively connected to a client and a management terminal, respectively.
As shown in fig. 5, the data processing apparatus 500 includes a first data storage device 510, a message middleware 520, and a second data storage device 530.
The first data storage device 510 is adapted to obtain first comment information of a user from the client, generate a primary key ID for the comment information, and store the first comment information. And the method is also suitable for receiving the update of the comment information by the administrator from the management terminal and carrying out corresponding update according to the received update content.
According to the embodiment of the invention, the first data storage device is implemented by a relational database, which may be any relational database such as Oracle, SQLServer, DB2, mysql, but is not limited thereto.
Message middleware 520 is adapted to synchronize data in the first data storage device 510 into the second data storage device 520. The message middleware can shield the difference of characteristics among different storage devices, so that the coupling degree between the first storage device and the second storage device is reduced, the logic responsibility degree when a user issues comments is reduced, and the operation of the user is responded more quickly.
Message middleware 520 may use any of ActiveMQ, rabbitMQ, kafka, etc., according to embodiments of the present invention, which is not limited in this regard.
The second data storage device 520 is adapted to store comment data synchronized by the message middleware 520, and eventually keeps consistent with the data in the first data storage device 510.
According to an embodiment of the present invention, the second data storage device 520 may be any one of CouchDB, mongoDb, sequoiaDB and the like, but is not limited thereto.
According to the data processing method, comment information published by a user is firstly stored in the first data storage device realized by the relational database and is synchronized to the second data storage device realized by the non-relational database through the message middleware, because the data in the relational database is stored according to time, an administrator can acquire the latest comment information through the relational database at a management terminal to perform sensitive information inquiry and update the comment information, and meanwhile, because the data in the non-relational data are stored in a tree structure according to the relation among the comment information, the processing rate of acquiring the comment information from the non-relational database through a client by the user can be improved, and the user experience is improved.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions of the methods and apparatus of the present invention, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U-drives, floppy diskettes, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the data processing method of the invention in accordance with instructions in said program code stored in the memory.
By way of example, and not limitation, readable media comprise readable storage media and communication media. The readable storage medium stores information such as computer readable instructions, data structures, program modules, or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with examples of the invention. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
It should be appreciated that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into a plurality of sub-modules.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
A8, the method of any of A1-A7, wherein when the update type is modified, the updating comment information in the first data storage device according to the second comment information and synchronizing to the second data storage device includes:
searching a comment record corresponding to the primary key ID from the first data storage device according to the primary key ID, and updating data in the comment record according to the second comment information;
synchronizing the second comment information with the message middleware;
and acquiring a corresponding comment record from the second data storage device according to the primary key ID in the second comment information of the message middleware, and updating the comment record.
A9, the method of A7 or A8, wherein when the type of the update is deletion, the updating the comment information in the first data storage device according to the second comment information, and synchronizing to the second data storage device includes:
searching comment records corresponding to the primary key ID from the first data storage device according to the primary key ID, and setting the comment records into a deleting state;
synchronizing the second comment information with the information system;
And acquiring corresponding comment records from the second data storage equipment according to the primary key ID in the second comment information in the information system, and placing the comment records in a deleting state.
The method of any one of A1-A9, further comprising:
and displaying the comment information in the second data storage equipment on the client according to the viewing request of the user on the client.
A11, the method of any one of A1-A10, wherein the first data storage device is a relational database.
A12, the method of any one of A1-A11, wherein the second data storage device is a non-relational database.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Furthermore, some of the embodiments are described herein as methods or combinations of method elements that may be implemented by a processor of a computer system or by other means of performing the functions. Thus, a processor with the necessary instructions for implementing the described method or method element forms a means for implementing the method or method element. Furthermore, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is for carrying out the functions performed by the elements for carrying out the objects of the invention.
As used herein, unless otherwise specified the use of the ordinal terms "first," "second," "third," etc., to describe a general object merely denote different instances of like objects, and are not intended to imply that the objects so described must have a given order, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the above description, will appreciate that other embodiments are contemplated within the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention, which is defined by the appended claims.