Commit Graph

8 Commits

Author SHA1 Message Date
Peng Gao 884405c431 Add namespace for Item and inline janitor
Signed-off-by: Peng Gao <peng.gao.dut@gmail.com>
2016-09-01 14:03:22 +08:00
Peng Gao f26e1d0b06 Fix #3, use put common code in individual a file
If there are more than one cache map to be generated
for different types, a redeclaration error will occur,
to avoid this error, put common part in a single file.

Signed-off-by: Peng Gao <peng.gao.dut@gmail.com>
2016-09-01 11:51:17 +08:00
Peng Gao f7f14e07e4 Support zero value in template
Signed-off-by: Peng Gao <peng.gao.dut@gmail.com>
2016-08-31 14:04:57 +08:00
Peng Gao 4378c9a40e Fix type finding bugs and add zero vaule for func
1.  In the main loop to find typeName, it will
    continue find type if a type has been already found,
    which will make empty string overwite it latter,
    so if it is found first time, assuming this is the
    type we want, and break out the loop.
2.  Add support for zero value for func type.
3.  If the type not a builtin type (*ast.Ident),
    assuming it is a composite structure, like
    *ast.StructType.

Signed-off-by: Peng Gao <peng.gao.dut@gmail.com>
2016-08-31 12:28:51 +08:00
Peng Gao ebc1ab826e Add decrement and increment for numberic types
Signed-off-by: Peng Gao <peng.gao.dut@gmail.com>
2016-08-29 18:58:22 +08:00
Peng Gao 5b06290188 Support zerovalue and fix tests
Signed-off-by: Peng Gao <peng.gao.dut@gmail.com>
2016-08-27 19:46:10 +08:00
Peng Gao 987311e3b4 Refactor code
1.  Add benchmark performance in README.md
2.  Use an Attr as argument for New to initiate a cache, in this
    way, more default settings can be supported.
3.  Add fast way for delete method, if no onEvicted callback
    function set.
4.  Use bool to indicate k existence in Get method to avoid
    pointer escape (which leads to memory allocation on heap),
    reference link below to get detail information.
    https://groups.google.com/forum/#!topic/golang-nuts/1WCWAtOsyDU

Signed-off-by: Peng Gao <peng.gao.dut@gmail.com>
2016-08-27 19:42:15 +08:00
Peng Gao 96eafc2dcd Add generator for code
Signed-off-by: Peng Gao <peng.gao.dut@gmail.com>
2016-08-11 16:42:28 +08:00