AD

erlang ETS can record for seamless integration

Reproduced an address ****javaeye**/topic/689089

erlang record as a data structure (a special Tuple, like an array), usually used for volume delivery function.
We can also choose to list ETS as a memory storage record, Ets very suitable for a large number of temporary data storage, the most important is that ETS can record for seamless integration.

%% Statement of record users under the Eshell
1> rd (users, (uid, website = "t.qq** / lajabs", name, time = time ()}).
users
%% Ets built on the table, and create in order to record as the index key element uid, the following additions and deletions will use it to change search
2> ets: new (users, [public, set, named_table, (keypos, # users.uid)]).
users
%% Create a record, and element assignment
3> Users = # users (uid = 101, name = lajabs).
# Users (uid = 101, website = "t.qq** / lajabs", name = lajabs,
time = (16,48,32))
%% Will create a good record into ets
4> ets: insert (users, Users).
true
%% Create a second record
5> Users2 = # users (uid = 102, name = laja2).
# Users (uid = 102, website = "t.qq** / lajabs", name = laja2,
time = (16,49,16))
%% To record users have stored ets, then users table with 2 records
6> ets: insert (users, Users2).
true
%% Try to check uid (index key) for the 102 records, a successful return to record (before the definition of variables Users2), need to pay attention to returns a list (with [])
7> ets: lookup (users, 102).
[# Users (uid = 102, website = "t.qq** / lajabs", name = laja2,
time = (16,49,16))]
%% Ets update on the record, the element name changed to 'hello'
8> ets: update_element (users, 102, (# users.name, hello)).
true
%% See the revised findings, the success has changed
9> ets: lookup (users, 102).
[# Users (uid = 102, website = "t.qq** / lajabs", name = hello,
time = (16,49,16))]
%% Remove the uid (index key) record for the 102
10> ets: delete (users, 102).
true
%% See the results have been removed successfully, return the empty list []
11> ets: lookup (users, 102).
[]
%% Query record the value of an element of the following ways
12> ets: lookup_element (users, 101, # users.name).
lajabs
标签: data storage, array, definition of variables, time time, time users, deletions, additions, data structure, element name, seamless integration, memory storage, storage record, tuple, rd users, ets
分类: Tech
时间: 2010-06-29

相关文章

  1. [3.25 update] [Eclipse plug-in] Snowberry public beta! - Seamless integration of your design and code

    [Update] March 25 on charges and free instructions, lisence can cause installation failures problems and take ...
  2. Integration of BPM and SOA: the importance of the model

    Richard Watson is a principal research analyst at Gartner. Recently, he wrote a lot about the BMP implementati ...
  3. spring integration MyBatis

    MyBatis Spring 1.0.0-RC2 Reference Documents MyBatis Community (MyBatis.org) Copyright © 2010 Copy of this doc ...
  4. Integration is the future of the power industry

    Looking at domestic and international large-scale enterprise information technology development path and devel ...
  5. Commonly used version control software

    Commonly used version control software According to view the network information, see the general use version ...
  6. Acegi at SSH (Struts + Spring + Hibernate) primary application of

    Last week, about Acegi security framework of the SSH application in the beginning because Acegi configuration ...
  7. Spring Security System: Acegi Security (change)

    The article does not reveal the picture you can refer to the Acegi's official article or download pdf document ...
  8. [zz] android introduction

    Android applications in conjunction with a core application package for release, the application package inclu ...
  9. Mainstream ERP technology

    Global ERP system, the two camps <br /> technical analysis from the original network] [bit, reproduced, ...
  10. Analysis of SalesForce

    Source: http://www.salesforce.com/cn/platform/what-is-it.jsp http://wiki.developerforce.com/index.php/Database ...
  11. . NET to use Oracle databases. Database Access Technology (B)

    In the article describes. NET Oracle data provider to use to access Oracle's methods and the way older databas ...
  12. jQuery actual combat (4) - tab menu

    2008-11-19 Article Category: Web front-end Many days ago to finish fourth actual jQuery spoke, but no time to ...
  13. web stress test tool description

    1. LoadRunner: support a variety of commonly used protocols to support multiple versions of individual agreeme ...
  14. C # Open Source Projects

    1, AOP framework Encase is developed for C #,. NET platform provides AOP framework. Encase provides the unique ...
  15. Google Analytics statistical comparison with Baidu

    Baidu Google Analytics and website statistics are used in site traffic analysis tools, and other traffic stati ...
  16. Documents on the Chinese android

    What is Android? Android is a specialized set of software for mobile devices, which includes an operating syst ...
  17. Integrated project development trend of R & D collaboration platform

    R & D collaboration platform is the direction to the development of highly integrated, so in June 2008 as ...
  18. Reprinted: Report software comparison and reference

    Reprinted: Report software comparison and reference http://www.cnblogs.com/freeze44/ Indicators and reporting ...
  19. Ten Internet business model

    z Transfer from: http://www.javaeye.com/topic/152532 The first traditional portal [View] Portal, essentially i ...