static {
    long initStart = System.currentTimeMillis();

    String cacheName = "dfaObj_v2.cache";
    DFA fa = SerializeUtil.read(cacheName);
    if (fa == null) {
      dfa = DFA.create(NodeCreater.create(DataCache.nameMap.keySet()));
      SerializeUtil.write(dfa, cacheName);
    } else {
      dfa = fa;
    }
    System.out.println("DFA init cost:" + (System.currentTimeMillis() - initStart));
  }
Exemple #2
0
 @Override
 public Object getObject(final Object key) {
   return execute(
       (jedis ->
           Optional.of(
               SerializeUtil.unserialize(
                   jedis.hget(id.toString().getBytes(), key.toString().getBytes())))));
 }
Exemple #3
0
 @Override
 public void putObject(final Object key, final Object value) {
   execute(
       jedis ->
           Optional.of(
               jedis.hset(
                   id.toString().getBytes(),
                   key.toString().getBytes(),
                   SerializeUtil.serialize(value))));
 }
  public static void main(String[] args) {

    Wrap wrap = new Wrap();
    wrap.args.add(new A());
    wrap.args.add(Boolean.class);
    wrap.args.add(Boolean.TRUE);
    wrap.args.add(new BigDecimal("123.456"));
    wrap.args.add(new Integer(123));
    wrap.args.add(new F(5));
    wrap.args.add(null);

    byte[] data = SerializeUtil.encode(wrap);
    System.out.println(data.length);

    for (Object arg : SerializeUtil.decode(data, Wrap.class).args) {
      if (arg != null) {
        System.out.println(arg.getClass());
        System.out.println(arg);
      } else {
        System.out.println("NULL");
        System.out.println(arg);
      }
    }
  }