Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1099

TPhpString: serialization/deserialization from string

    XMLWordPrintableJSON

    Details

    • Patch Info:
      Patch Available

      Description

      I want to serialize thrift instances to save them to disk, serialize them in session, transfer them them to elephant bird, ...

      Therefore i build a class named TPhpString which extends TTransport and can be accessed like other TTransports.
      I added additional getters to easy convert in both directions: from string to instance, from instance to string.
      I provided the class as a patch and hope that it will be integrated, see the examples below:

      write example:
      $vector = new VectorSequence(array('query' => 'easy coding thrift server example'));
      $body = TPhpString::getStringFromInstance($vector);
      file_put_contents('/tmp/apache', $body);

      read example:
      $body = file_get_contents('/tmp/apache');
      $vector = TPhpString::getInstanceFromString('VectorSequence', $evt->body);
      print_r($vector);

      I build a tutorial in german about it: http://www.easy-coding.de/wiki/php/thrift-php-server.html

        Attachments

        1. patch.diff
          2 kB
          Torben Brodt

          Activity

            People

            • Assignee:
              tbrodt Torben Brodt
              Reporter:
              tbrodt Torben Brodt
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified