This discussion is archived
1 Reply Latest reply: Oct 18, 2013 4:11 AM by Jonathan.Knight RSS

Not able to get value from cache by using filter

user9028169 Newbie
Currently Being Moderated

Hi, I am trying to put a value in cache and trying to fetch it back by creating a filter.

 

But not able to get the value.

 

Am i doing any mistake in creating filter

 

 

putEmployeeInCache("abc");

ValueExtractor nameValueExtractor = new PofExtractor(null, new SimplePofPath(new int[0]), PofExtractor.VALUE);

Filter equalsFilterToFetchByName = new EqualsFilter(nameValueExtractor, "abc");

employeeCache().entrySet(equalsFilterToFetchByName)

 

employeeCache().entrySet(equalsFilterToFetchByName) is returning NULL

 

putting employee in cache employeeCache().put(employee.getName(), employee);

 

Snipeet from employee class

@Override

    public void readExternal(PofReader pofReader) throws IOException {

        name = pofReader.readString(0);

        age = pofReader.readInt(1);

    }

 

    @Override

    public void writeExternal(PofWriter pofWriter) throws IOException {

        pofWriter.writeString(0, name);

        pofWriter.writeInt(1, age);

    }