Package com.thimbleware.jmemcached

Examples of com.thimbleware.jmemcached.MCElement


                short flags = (short) (extrasBuffer.capacity() != 0 ? extrasBuffer.readUnsignedShort() : 0);
               
                // the remainder of the message -- that is, totalLength - (keyLength + extraLength) should be the payload
                int size = totalBodyLength - keyLength - extraLength;

                cmdMessage.element = new MCElement(key, flags, expire != 0 && expire < MCElement.THIRTY_DAYS ? MCElement.Now() + expire : expire, size);
                cmdMessage.element.data = new byte[size];
                channelBuffer.readBytes(cmdMessage.element.data, 0, size);
            } else if (cmdType == Command.INCR || cmdType == Command.DECR) {
                long initialValue = extrasBuffer.readUnsignedInt();
                long amount = extrasBuffer.readUnsignedInt();
View Full Code Here


        // write value if there is one
        ChannelBuffer valueBuffer = null;
        if (command.elements != null) {
            extrasBuffer = ChannelBuffers.buffer(ByteOrder.BIG_ENDIAN, 4);
            MCElement element = command.elements[0];
            extrasBuffer.writeShort((short) (element != null ? element.expire : 0));
            extrasBuffer.writeShort((short) (element != null ? element.flags : 0));

            if ((command.cmd.cmd == Command.GET || command.cmd.cmd == Command.GETS)) {
                valueBuffer = ChannelBuffers.buffer(ByteOrder.BIG_ENDIAN, (element != null ? element.dataLength : 0));
View Full Code Here

                throw new IllegalStateException("Stored item should not be null. Id:" + keystring);
            }
        } else {
            return null;
        }
        MCElement el = new MCElement(keystring, result.flags, result.expire, result.region.size);
        el.data = store.get(result.region);

        return el;
    }
View Full Code Here

            // Fill in all the elements of the command
            int size = Integer.parseInt(parts[4]);
            int expire = Integer.parseInt(parts[3]);
            int flags = Integer.parseInt(parts[2]);
            cmd.element = new MCElement(parts[1], flags, expire != 0 && expire < MCElement.THIRTY_DAYS ? MCElement.Now() + expire : expire, size);

            // look for cas and "noreply" elements
            if (numParts > 5) {
                int noreply = cmdType == Command.CAS ? 6 : 5;
                if (cmdType == Command.CAS) {
View Full Code Here

TOP

Related Classes of com.thimbleware.jmemcached.MCElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.