CN106156309A - Method for reading data and device - Google Patents

Method for reading data and device Download PDF

Info

Publication number
CN106156309A
CN106156309A CN201610510467.XA CN201610510467A CN106156309A CN 106156309 A CN106156309 A CN 106156309A CN 201610510467 A CN201610510467 A CN 201610510467A CN 106156309 A CN106156309 A CN 106156309A
Authority
CN
China
Prior art keywords
data
redemption code
commodity
use state
data base
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
CN201610510467.XA
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.)
Beijing 58 Information Technology Co Ltd
Original Assignee
Beijing 58 Information Technology 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 Beijing 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN201610510467.XA priority Critical patent/CN106156309A/en
Publication of CN106156309A publication Critical patent/CN106156309A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24532Query optimisation of parallel queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24539Query rewriting; Transformation using cached or materialised query results

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of method for reading data and device.The method includes: while data and use state are saved in data base, write data into buffer queue;From buffer queue, read data, and the use state of data in data base is updated.By means of technical scheme, it is possible to be effectively improved height the data reading performance using redundancy given, it is to avoid the problem causing request to block time-out because of waiting the row lock of data base.

Description

Method for reading data and device
Technical field
The present invention relates to field of computer technology, particularly relate to a kind of method for reading data and device.
Background technology
At present, online shopping mall can use the convertible commodity of virtual gold coin, when exchanging commodity, need according to redemption code Exchange, in the prior art, redemption code is stored in data base, from exchanging reading code table every time when of providing commodity One redemption code, changes into exchanging by redemption code state, then redemption code is put in user's order.
In time exchanging one redemption code of reading in code table, it is intended to call renewal redemption code and uses affairs, affairs use Row lock, because updating operation is not to operate with major key, is limit mono-data in all redemption code do not exchanged, In MYSQL database, limit clause can be used for forcing SELECT statement to return the record number specified.So complications Lower inquiry is very slow, causes other transactional lock to wait time-out, it is impossible to be normally carried out awarding prizes.
Summary of the invention
In view of when concurrently reading data in prior art, database update row latching operation causes asking of transaction latency time-out slowly Topic, it is proposed that the present invention is to provide a kind of digital independent side overcoming the problems referred to above or solving the problems referred to above at least in part Method and device.
The present invention provides a kind of method for reading data, including:
While data and use state are saved in data base, write data into buffer queue;
From buffer queue, read data, and the use state of data in data base is updated.
Present invention also offers a kind of digital independent device, including:
Preserve module, while data and use state are saved in data base, write data into buffer queue;
Read module, for reading data from buffer queue, and is updated the use state of data in data base.
The present invention has the beneficial effect that:
While data and use state are saved in data base, described data are write buffer queue, solves The problem that when concurrently reading data in prior art, database update row latching operation causes transaction latency time-out slowly, it is possible to effectively carry High high and that give data reading performance using redundancy, it is to avoid the problem causing request to block time-out because of waiting the row lock of data base.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention, And can be practiced according to the content of description, and in order to allow above and other objects of the present invention, the feature and advantage can Become apparent, below especially exemplified by the detailed description of the invention of the present invention.
Accompanying drawing explanation
By reading the detailed description of hereafter preferred implementation, various other advantage and benefit common for this area Technical staff will be clear from understanding.Accompanying drawing is only used for illustrating the purpose of preferred implementation, and is not considered as the present invention Restriction.And in whole accompanying drawing, it is denoted by the same reference numerals identical parts.In the accompanying drawings:
Fig. 1 is the flow chart of the method for reading data of the embodiment of the present invention;
Fig. 2 is the structural representation of the digital independent device of the embodiment of the present invention.
Detailed description of the invention
It is more fully described the exemplary embodiment of the disclosure below with reference to accompanying drawings.Although accompanying drawing shows the disclosure Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure and should be by embodiments set forth here Limited.On the contrary, it is provided that these embodiments are able to be best understood from the disclosure, and can be by the scope of the present disclosure Complete conveys to those skilled in the art.
In order to when solving concurrently to read data in prior art, database update row latching operation causes transaction latency time-out slowly Problem, the invention provides a kind of method for reading data and device, below in conjunction with accompanying drawing and embodiment, the present invention carried out Further describe.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, does not limit this Bright.
Embodiment of the method
According to embodiments of the invention, it is provided that a kind of method for reading data, Fig. 1 is the digital independent of the embodiment of the present invention The flow chart of method, as it is shown in figure 1, method for reading data according to embodiments of the present invention includes processing as follows:
Step 101, while data and use state are saved in data base, writes data into buffer queue;Wherein, on State data to include: the multiple redemption code corresponding to commodity ID and commodity ID.It is to say, commodity and redemption code are one-to-manies Relation.And above-mentioned use state includes: redemption code has used and do not used with redemption code.This use state can be added up for the day after tomorrow Inquiry is used.
Step 102, takes out data from buffer queue, and the use state of data in data base is updated.
Step 102 specifically includes and processes as follows:
Step 1021, searches corresponding commodity ID according to the commodity that user exchanges;
Step 1022, takes out a redemption code from the redemption code corresponding with commodity ID;It should be noted that take out one After redemption code refers to read redemption code, just this redemption code is deleted from this buffer queue.
Step 1023, is updated to use by the use state of this redemption code in data base.
In a step 102, by after in data base, the use state of data is updated, it is possible to the redemption code that will obtain It is put into the granting completing redemption code in user's order.
It can be seen from the above description that when redemption code is uploaded on merchandise control backstage, need just redemption code to tie up with commodity While degree write into Databasce in buffer queue to be write, from buffer queue, when providing commodity, first take out a redemption code, Then go lane database to update the state of this redemption code, then this redemption code is put in user's order, complete the granting of prize.
Above-mentioned process reduces the pressure of data base, stores and quick obtaining redemption code information, have by the way of caching Effect control height and during the prize given provides, the acquisition of redemption code and renewal, it is to avoid wait that the row lock of data base is made Become the problem that time-out is blocked in request.
Device embodiment
According to embodiments of the invention, it is provided that a kind of digital independent device, Fig. 2 is the digital independent of the embodiment of the present invention The structural representation of device, as in figure 2 it is shown, digital independent device according to embodiments of the present invention includes: preserve module 20 and read Delivery block 22, is described in detail the modules of the embodiment of the present invention below.
Preserve module 20, while data and use state are saved in data base, by described data write caching Queue;Wherein, above-mentioned data include: the multiple redemption code corresponding to commodity ID and commodity ID.It is to say, commodity and converting Escape is the relation of one-to-many.And above-mentioned use state includes: redemption code has used and do not used with redemption code.This use state can Use for the statistical query day after tomorrow.
Read module 22, for taking out described data, and by data described in described data base from described buffer queue Use state be updated.
Described read module 22 specifically for:
Corresponding commodity ID is searched according to the commodity that user exchanges;
A redemption code is taken out from the redemption code corresponding with commodity ID;It should be noted that take out a redemption code it is After referring to read redemption code, just this redemption code is deleted from this buffer queue.
It is updated to use by the use state of this redemption code in data base.
Said apparatus farther includes:
Provide module, for the use state of data described in described data base being updated it at described read module After, the described redemption code obtained is put into the granting completing redemption code in user's order.
It can be seen from the above description that when redemption code is uploaded on merchandise control backstage, need just redemption code to tie up with commodity While degree write into Databasce in buffer queue to be write, from buffer queue, when providing commodity, first take out a redemption code, Then go lane database to update the state of this redemption code, then this redemption code is put in user's order, complete the granting of prize.
Above-mentioned process reduces the pressure of data base, stores and quick obtaining redemption code information, have by the way of caching Effect control height and during the prize given provides, the acquisition of redemption code and renewal, it is to avoid wait that the row lock of data base is made Become the problem that time-out is blocked in request.
Obviously, those skilled in the art can carry out various change and the modification essence without deviating from the present invention to the present invention God and scope.So, if these amendments of the present invention and modification belong to the scope of the claims in the present invention and equivalent technologies thereof Within, then the present invention is also intended to comprise these change and modification.
Algorithm and display are not intrinsic to any certain computer, virtual system or miscellaneous equipment relevant provided herein. Various general-purpose systems can also be used together with based on teaching in this.As described above, construct required by this kind of system Structure be apparent from.Additionally, the present invention is also not for any certain programmed language.It is understood that, it is possible to use various Programming language realizes the content of invention described herein, and the description done language-specific above is to disclose this Bright preferred forms.
In description mentioned herein, illustrate a large amount of detail.It is to be appreciated, however, that the enforcement of the present invention Example can be put into practice in the case of not having these details.In some instances, it is not shown specifically known method, structure And technology, in order to do not obscure the understanding of this description.
Similarly, it will be appreciated that one or more in order to simplify that the disclosure helping understands in each inventive aspect, exist Above in the description of the exemplary embodiment of the present invention, each feature of the present invention is grouped together into single enforcement sometimes In example, figure or descriptions thereof.But, the method for the disclosure should not be construed to reflect an intention that i.e. required guarantor The application claims feature more more than the feature being expressly recited in each claim protected.More precisely, as following Claims reflected as, inventive aspect is all features less than single embodiment disclosed above.Therefore, The claims following detailed description of the invention are thus expressly incorporated in this detailed description of the invention, the most each claim itself All as the independent embodiment of the present invention.
Those skilled in the art are appreciated that and the module in the client in embodiment can be carried out adaptivity Ground changes and they is arranged in one or more clients different from this embodiment.Can be the module in embodiment It is combined into a module, and multiple submodule or subelement or sub-component can be put them in addition.Except such spy Levy and/or outside at least some in process or unit excludes each other, can use any combination that this specification (is included Adjoint claim, summary and accompanying drawing) disclosed in all features and so disclosed any method or client All processes or unit are combined.Unless expressly stated otherwise, this specification (includes adjoint claim, summary and attached Figure) disclosed in each feature can be replaced by providing identical, equivalent or the alternative features of similar purpose.
Although additionally, it will be appreciated by those of skill in the art that embodiments more described herein include other embodiments Some feature included by rather than further feature, but the combination of the feature of different embodiment means to be in the present invention's Within the scope of and form different embodiments.Such as, in the following claims, embodiment required for protection appoint One of meaning can mode use in any combination.
The all parts embodiment of the present invention can realize with hardware, or to run on one or more processor Software module realize, or with combinations thereof realize.It will be understood by those of skill in the art that and can use in practice Microprocessor or digital signal processor (DSP) realize the client being loaded with sequence network address according to embodiments of the present invention In the some or all functions of some or all parts.The present invention is also implemented as performing as described herein Part or all equipment of method or device program (such as, computer program and computer program).So The program realizing the present invention can store on a computer-readable medium, or can have the shape of one or more signal Formula.Such signal can be downloaded from internet website and obtain, or provides on carrier signal, or with any other shape Formula provides.
The present invention will be described rather than limits the invention to it should be noted above-described embodiment, and ability Field technique personnel can design alternative embodiment without departing from the scope of the appended claims.In the claims, Any reference marks that should not will be located between bracket is configured to limitations on claims.Word " comprises " and does not excludes the presence of not Arrange element in the claims or step.Word "a" or "an" before being positioned at element does not excludes the presence of multiple such Element.The present invention and can come real by means of including the hardware of some different elements by means of properly programmed computer Existing.If in the unit claim listing equipment for drying, several in these devices can be by same hardware branch Specifically embody.Word first, second and third use do not indicate that any order.These word explanations can be run after fame Claim.

Claims (8)

1. a method for reading data, it is characterised in that including:
While data and use state are saved in data base, described data are write buffer queue;
From described buffer queue, take out described data, and the use state of data described in described data base is updated.
2. the method for claim 1, it is characterised in that described data include: commodity ID and described commodity ID institute is right The multiple redemption code answered.
3. method as claimed in claim 2, it is characterised in that take out described data from described buffer queue, and by described The use state of data described in data base is updated specifically including:
Corresponding commodity ID is searched according to the commodity that user exchanges;
From with described redemption code corresponding for commodity ID take out a redemption code;
It is updated to use by the use state of this redemption code in described data base.
4. method as claimed in claim 3, it is characterised in that the use state of data described in described data base is carried out more After Xin, described method farther includes:
The described redemption code obtained is put into the granting completing redemption code in user's order.
5. a digital independent device, it is characterised in that including:
Preserve module, while data and use state are saved in data base, described data are write buffer queue;
Read module, for taking out described data, and by the use of data described in described data base from described buffer queue State is updated.
6. device as claimed in claim 5, it is characterised in that described data include: commodity ID and described commodity ID institute is right The multiple redemption code answered.
7. device as claimed in claim 6, it is characterised in that described read module specifically for:
Corresponding commodity ID is searched according to the commodity that user exchanges;
From with described redemption code corresponding for commodity ID take out a redemption code;
It is updated to use by the use state of this redemption code in described data base.
8. device as claimed in claim 7, it is characterised in that described device farther includes:
Provide module, be used for after the use state of data described in described data base is updated by described read module, The described redemption code obtained is put into the granting completing redemption code in user's order.
CN201610510467.XA 2016-07-01 2016-07-01 Method for reading data and device Pending CN106156309A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610510467.XA CN106156309A (en) 2016-07-01 2016-07-01 Method for reading data and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610510467.XA CN106156309A (en) 2016-07-01 2016-07-01 Method for reading data and device

Publications (1)

Publication Number Publication Date
CN106156309A true CN106156309A (en) 2016-11-23

Family

ID=57350802

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610510467.XA Pending CN106156309A (en) 2016-07-01 2016-07-01 Method for reading data and device

Country Status (1)

Country Link
CN (1) CN106156309A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106875226A (en) * 2017-02-24 2017-06-20 湖南安良信息科技有限公司 One kind panic buying behavior monitoring method and system
CN107679931A (en) * 2017-08-17 2018-02-09 平安科技(深圳)有限公司 Method, apparatus, storage medium and the terminal of order asynchronous process
CN108665335A (en) * 2017-04-01 2018-10-16 北京京东尚科信息技术有限公司 The method for handling the shopping cart data of shopping website
CN110570236A (en) * 2019-08-21 2019-12-13 温州市鼎销工艺礼品有限公司 Red envelope getting system getting method
CN110738507A (en) * 2018-07-18 2020-01-31 北京京东金融科技控股有限公司 exchange code acquisition method and device
CN112308599A (en) * 2020-08-31 2021-02-02 北京沃东天骏信息技术有限公司 Redemption code issuing method, system and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102938731A (en) * 2012-11-22 2013-02-20 北京锐易特软件技术有限公司 Exchange and integration device and method based on proxy cache adaptation model
CN103400164A (en) * 2013-07-18 2013-11-20 无锡凯施智联软件科技有限公司 Real-time radio frequency identification data acquisition method
CN103577551A (en) * 2013-10-16 2014-02-12 青岛海信传媒网络技术有限公司 Method and device for submitting data to database in batch
CN105468690A (en) * 2015-11-17 2016-04-06 中国建设银行股份有限公司 Inventory data processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102938731A (en) * 2012-11-22 2013-02-20 北京锐易特软件技术有限公司 Exchange and integration device and method based on proxy cache adaptation model
CN103400164A (en) * 2013-07-18 2013-11-20 无锡凯施智联软件科技有限公司 Real-time radio frequency identification data acquisition method
CN103577551A (en) * 2013-10-16 2014-02-12 青岛海信传媒网络技术有限公司 Method and device for submitting data to database in batch
CN105468690A (en) * 2015-11-17 2016-04-06 中国建设银行股份有限公司 Inventory data processing method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106875226A (en) * 2017-02-24 2017-06-20 湖南安良信息科技有限公司 One kind panic buying behavior monitoring method and system
CN108665335A (en) * 2017-04-01 2018-10-16 北京京东尚科信息技术有限公司 The method for handling the shopping cart data of shopping website
CN107679931A (en) * 2017-08-17 2018-02-09 平安科技(深圳)有限公司 Method, apparatus, storage medium and the terminal of order asynchronous process
CN110738507A (en) * 2018-07-18 2020-01-31 北京京东金融科技控股有限公司 exchange code acquisition method and device
CN110570236A (en) * 2019-08-21 2019-12-13 温州市鼎销工艺礼品有限公司 Red envelope getting system getting method
CN112308599A (en) * 2020-08-31 2021-02-02 北京沃东天骏信息技术有限公司 Redemption code issuing method, system and device

Similar Documents

Publication Publication Date Title
CN106156309A (en) Method for reading data and device
AU2020203406B2 (en) Method and system for identity and credential protection and verification via blockchain
CN104123235B (en) Access the apparatus and method for storing the data record in cache on the server
US10318501B2 (en) Systems and methods for assessing data quality
CN108985927A (en) For making the method and system of the electronic transaction anonymization via block chain
US11249980B2 (en) Updating of in-memory synopsis metadata for inserts in database table
CN104572860B (en) A kind of data processing method and system
CN104794146B (en) The method and apparatus that commodity are screened and sorted in real time
AU2019201594A1 (en) Method and system for retry processing of controlled payment transactions
CN104516895A (en) Stock information processing method and system for commodity object
CN112514349B (en) Detecting duplication using exact and fuzzy matching of cryptographic matching indices
CN103605703A (en) Method and system for data consistency detection among multiple platforms
WO2022186954A1 (en) Method and system of implenting partitioned blockchain
US20130185086A1 (en) Generation of sales leads using customer problem reports
US10984396B2 (en) Method and system for distribution of data insights
CN105354621A (en) Method and apparatus for determining storage modes of articles in multiple storage regions
CN105389394A (en) Data request processing method and device based on a plurality of database clusters
US20180189785A1 (en) Method and system for secured merchant verification
CN104021192A (en) Database renewing method and device
CN111831750A (en) Block chain data analysis method and device, computer equipment and storage medium
CN109815213A (en) It is deleted on a kind of Append-Only database and the method and system of modification data
CN108241607A (en) Automatically imported method, server and the storage medium of test of heuristics case
CN104680380A (en) Method and device for determining band card transaction places
Cao et al. Undersampling correction methods to control γ‐dependence for comparing β‐diversity between regions
CN111831964B (en) Data report information processing method and device and computer system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20161123

RJ01 Rejection of invention patent application after publication