Skip to content

Commit 399bb96

Browse files
committedJul 3, 2020
Add info on exercise 24.3
1 parent ecc12a0 commit 399bb96

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
 

‎chapter_24/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,22 @@ ok
4343
```
4444

4545
**3. Make a key value store where some key-value pairs are persistent and others are transient. Calling `put(Key, memory, Val)` will store a key-value pair in memory, `put(Key, disk, Val)` should store the data on disk. Use a pair of processes to do this, one for the persistent store and one for the disk store. Reuse the earlier code in the chapter.**
46+
47+
Solution in the [exercise_3](exercise_3/) directory. It wasn't clear to me what the significance was between exercise 2 and exercise 3 other than the use of two processes. The processes themselves aren't really doing much as I chose to continue to use ETS and DETS tables to store the key value data. The gen_server implementation is a little unique in that it is effectively two different gen_server implementations in the same module. It worked out well enough, but I'm not sure it's a good pattern because there ended up being two distinct sets of code.
48+
49+
Compile the Erlang files:
50+
51+
```
52+
erlc *.erl
53+
```
54+
55+
Run the tests in the shell:
56+
57+
```
58+
$ erl
59+
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
60+
61+
Eshell V9.3 (abort with ^G)
62+
1> adapter_db1_test:test().
63+
ok
64+
```

0 commit comments

Comments
 (0)
Please sign in to comment.