diff options
| author | Mark Pulford <mark@kyne.com.au> | 2011-05-10 22:32:01 +0930 |
|---|---|---|
| committer | Mark Pulford <mark@kyne.com.au> | 2011-05-10 22:32:01 +0930 |
| commit | 126470cc7b6c2314c02805e4d00afe04b6b00312 (patch) | |
| tree | 9dd59bcc02307403410ef405b0f02bf39bd57560 /README | |
| parent | c877da6c1f84b19cd2e7e8154b4a0d0e355745a0 (diff) | |
| download | lua-cjson-126470cc7b6c2314c02805e4d00afe04b6b00312.tar.gz lua-cjson-126470cc7b6c2314c02805e4d00afe04b6b00312.tar.bz2 lua-cjson-126470cc7b6c2314c02805e4d00afe04b6b00312.zip | |
Add runtime option for persistent encode buffer
Diffstat (limited to 'README')
| -rw-r--r-- | README | 17 |
1 files changed, 15 insertions, 2 deletions
| @@ -34,8 +34,7 @@ Build requirements: | |||
| 34 | Or: | 34 | Or: |
| 35 | - LuaJIT (http://www.luajit.org/) | 35 | - LuaJIT (http://www.luajit.org/) |
| 36 | 36 | ||
| 37 | The included Makefile should be reviewed. Updated the Makefile to suit | 37 | Review and update the included Makefile to suit your platform. Then: |
| 38 | your platform and Lua header/library directories. Then: | ||
| 39 | 38 | ||
| 40 | # make | 39 | # make |
| 41 | # make install | 40 | # make install |
| @@ -66,6 +65,7 @@ Synopsis | |||
| 66 | setting = cjson.refuse_invalid_numbers([setting]) | 65 | setting = cjson.refuse_invalid_numbers([setting]) |
| 67 | depth = cjson.encode_max_depth([depth]) | 66 | depth = cjson.encode_max_depth([depth]) |
| 68 | convert, ratio, safe = cjson.encode_sparse_array([convert[, ratio[, safe]]]) | 67 | convert, ratio, safe = cjson.encode_sparse_array([convert[, ratio[, safe]]]) |
| 68 | keep = cjson.encode_keep_buffer([keep]) | ||
| 69 | 69 | ||
| 70 | 70 | ||
| 71 | Encoding | 71 | Encoding |
| @@ -204,6 +204,19 @@ the application. Eg: | |||
| 204 | a = {}; b = { a }; a[1] = b | 204 | a = {}; b = { a }; a[1] = b |
| 205 | 205 | ||
| 206 | 206 | ||
| 207 | Persistent encoding buffer | ||
| 208 | ------------------------- | ||
| 209 | |||
| 210 | keep = cjson.keep_encode_buffer([keep]) | ||
| 211 | -- "keep" must be a boolean | ||
| 212 | |||
| 213 | By default, CJSON will reuse the JSON encoding buffer to improve | ||
| 214 | performance. The buffer will grow to the largest size required and is | ||
| 215 | not freed until CJSON is garbage collected. Setting this option to | ||
| 216 | "false" will cause the buffer to be freed after each call to | ||
| 217 | cjson.encode(). | ||
| 218 | |||
| 219 | |||
| 207 | References | 220 | References |
| 208 | ========== | 221 | ========== |
| 209 | 222 | ||
